Skip to content
Snippets Groups Projects
Commit b9954ab5 authored by Andi14-prog's avatar Andi14-prog
Browse files

Fixed anoying Bugs and made the last Playtests

parent 95eece1e
Branches Andi_Mark
No related tags found
No related merge requests found
...@@ -11580,7 +11580,7 @@ PrefabInstance: ...@@ -11580,7 +11580,7 @@ PrefabInstance:
- target: {fileID: 8182354677883374721, guid: b07552db700124a4680401e6fb94c186, - target: {fileID: 8182354677883374721, guid: b07552db700124a4680401e6fb94c186,
type: 3} type: 3}
propertyPath: m_AnchoredPosition.x propertyPath: m_AnchoredPosition.x
value: 940 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8182354677883374721, guid: b07552db700124a4680401e6fb94c186, - target: {fileID: 8182354677883374721, guid: b07552db700124a4680401e6fb94c186,
type: 3} type: 3}
...@@ -30149,7 +30149,7 @@ RectTransform: ...@@ -30149,7 +30149,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -18.499939} m_AnchoredPosition: {x: 0, y: -18.499939}
m_SizeDelta: {x: 480, y: 320} m_SizeDelta: {x: 680, y: 520}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &936581421 --- !u!114 &936581421
MonoBehaviour: MonoBehaviour:
...@@ -30192,7 +30192,7 @@ CanvasRenderer: ...@@ -30192,7 +30192,7 @@ CanvasRenderer:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 936581419} m_GameObject: {fileID: 936581419}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 0
--- !u!1001 &937462613 --- !u!1001 &937462613
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -69011,6 +69011,11 @@ MonoBehaviour: ...@@ -69011,6 +69011,11 @@ MonoBehaviour:
ingredient3: {fileID: 648095404} ingredient3: {fileID: 648095404}
ingredient4: {fileID: 281747982} ingredient4: {fileID: 281747982}
finishedMaterial: {fileID: 2100000, guid: 2f12fcec4b3dcc0489472b3a9cfa44c1, type: 2} finishedMaterial: {fileID: 2100000, guid: 2f12fcec4b3dcc0489472b3a9cfa44c1, type: 2}
maxNumberPropsDisplayed: 11
circleRadius: 1
heightAbove: 2
rotationSpeed: 50
propScale: 0.5
--- !u!1001 &2132461601 --- !u!1001 &2132461601
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -16,7 +16,9 @@ public class BookGlowAndInteract : MonoBehaviour ...@@ -16,7 +16,9 @@ public class BookGlowAndInteract : MonoBehaviour
private bool active; private bool active;
private SimpleMessageDisplay messageDisplay; private SimpleMessageDisplay messageDisplay;
private BrewingPotInteract brewingPot; private BrewingPotInteract brewingPot;
private string lgs = "Solve this riddle to brew the Potion\n6a +3b +4d = 39\n3b +4d -2c = 25\n2a -2c +3b = 17\n5a +3 = 13\n\na is the big red mushroom, b the red flower\nc the brown mushroom and d the small red mushroom\nClose with ESC";
private int[] sol ={2,5,1,3};
void Start() void Start()
{ {
objectRenderer = GetComponent<Renderer>(); objectRenderer = GetComponent<Renderer>();
...@@ -65,8 +67,7 @@ void Update() ...@@ -65,8 +67,7 @@ void Update()
{ {
clicked = true; clicked = true;
objectRenderer.material = originalMaterial; objectRenderer.material = originalMaterial;
messageDisplay.ShowMessage("Hallllooooo\n \n \n Close with ESC"); messageDisplay.ShowMessage(lgs);
Debug.LogError("Hit registered Where text???!");
} }
} }
} }
......
...@@ -10,26 +10,94 @@ public class BrewingPotInteract : MonoBehaviour ...@@ -10,26 +10,94 @@ public class BrewingPotInteract : MonoBehaviour
public GameObject ingredient4; public GameObject ingredient4;
public Material finishedMaterial; public Material finishedMaterial;
private List<string> recipe = new List<string>(); private List<GameObject> recipe = new List<GameObject>();
private int counter = 0; private int counter = 0;
private Renderer objectRenderer; private Renderer objectRenderer;
private bool finished = false; private bool finished = false;
private string lgs; private string lgs;
public int maxNumberPropsDisplayed = 11;
public float circleRadius = 1.0f;
public float heightAbove = 2.0f;
public float rotationSpeed = 50.0f;
public float propScale = 0.5f;
private GameObject[] props;
private int propCount = 0;
private float[] angles;
//solution values for the LGS
private int[] sol ={2,5,1,3};
private int numberOfPropsInRecipe;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
//For now build the recipe here GameObject[] obj = {ingredient1,ingredient2,ingredient3,ingredient4};
recipe.Add(ingredient1.name);
recipe.Add(ingredient2.name);
recipe.Add(ingredient3.name);
recipe.Add(ingredient4.name);
for(int i = 0; i < sol.Length; i++)
{
for(int x = 0; x < sol[i] ; x++)
{
recipe.Add(obj[i]);
numberOfPropsInRecipe++;
}
}
objectRenderer = GetComponent<Renderer>(); objectRenderer = GetComponent<Renderer>();
props = new GameObject[maxNumberPropsDisplayed];
angles = new float[maxNumberPropsDisplayed];
}
void Update()
{
for (int i = 0; i < propCount; i++)
{
if (props[i] != null)
{
angles[i] += rotationSpeed * Time.deltaTime;
if (angles[i] >= 360.0f)
{
angles[i] -= 360.0f;
}
UpdatePropPosition(i);
}
}
}
void UpdatePropPosition(int index)
{
float radians = angles[index] * Mathf.Deg2Rad;
Vector3 offset = new Vector3(Mathf.Cos(radians), 0, Mathf.Sin(radians)) * circleRadius;
props[index].transform.position = transform.position + offset + Vector3.up * heightAbove;
} }
void AddProp(GameObject prop){
if(propCount < maxNumberPropsDisplayed){
props[propCount] = Instantiate(prop);
props[propCount].transform.localScale = Vector3.one * propScale;
angles[propCount] = propCount * (360.0f / maxNumberPropsDisplayed);
UpdatePropPosition(propCount);
propCount++;
}
}
void RemoveAllProps(){
for(int i = 0; i < propCount; i++)
{
Destroy(props[i]);
}
propCount = 0;
props = new GameObject[maxNumberPropsDisplayed];
angles = new float[maxNumberPropsDisplayed];
}
void OnMouseDown() void OnMouseDown()
{ {
if(finished){ if(finished){
...@@ -39,21 +107,19 @@ void OnMouseDown() ...@@ -39,21 +107,19 @@ void OnMouseDown()
if (ClickTracker.Instance != null) if (ClickTracker.Instance != null)
{ {
string item = ClickTracker.Instance.RemoveOneItem(); string item = ClickTracker.Instance.RemoveOneItem();
if(string.Compare(item,recipe[counter]) == 0){ if(string.Compare(item,recipe[counter].name) == 0){
if(counter == 3){ AddProp(recipe[counter]);
if(counter == numberOfPropsInRecipe - 1){
objectRenderer.material = finishedMaterial; objectRenderer.material = finishedMaterial;
finished = true; finished = true;
} }
counter ++; counter ++;
} else { } else {
RemoveAllProps();
counter = 0; counter = 0;
} }
} else { } else {
Debug.LogError("ClickTracker: Instance is null"); Debug.LogError("ClickTracker: Instance is null");
} }
} }
public string getLGS(){
return lgs;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment