diff --git a/Assets/Scenes/Microgame.unity b/Assets/Scenes/Microgame.unity index 782479a..6f1aaeb 100644 --- a/Assets/Scenes/Microgame.unity +++ b/Assets/Scenes/Microgame.unity @@ -154,6 +154,7 @@ Transform: - {fileID: 4247525904715324788} - {fileID: 969727960} - {fileID: 545835881} + - {fileID: 1450998026} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &39988345 @@ -172,6 +173,30 @@ MonoBehaviour: score: 0 minimumScore: 0 loseOnTimeLimit: 0 + allChemicals: + - {fileID: 8295328535859936024, guid: e06ef78656b2a6f2192663a7823bd11d, type: 3} + - {fileID: 2582319904853532176, guid: 71d63498eb5bcc8cda40f0630a51fb9d, type: 3} + - {fileID: 4191594833665133771, guid: 03e57f0a123b64ac19e40f721b88e453, type: 3} + chemicalSpawnPoints: + - location: {fileID: 1730721400} + inUse: 0 + - location: {fileID: 334296393} + inUse: 0 + - location: {fileID: 1051529130} + inUse: 0 + - location: {fileID: 932236990} + inUse: 0 + - location: {fileID: 536701364} + inUse: 0 + - location: {fileID: 547469734} + inUse: 0 + - location: {fileID: 1810651926} + inUse: 0 + - location: {fileID: 1665757569} + inUse: 0 + chemicalInstances: [] + allPotions: + - {fileID: 11400000, guid: b9b05561a57f0e400b9930cff4f1ca01, type: 2} currentPotion: {fileID: 11400000, guid: b9b05561a57f0e400b9930cff4f1ca01, type: 2} requestedPotions: - {fileID: 11400000, guid: b9b05561a57f0e400b9930cff4f1ca01, type: 2} @@ -180,6 +205,37 @@ MonoBehaviour: currentPotionIndex: 0 potionRecipeTitle: {fileID: 1633930260} potionRecipeText: {fileID: 1471730744} +--- !u!1 &334296392 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 334296393} + m_Layer: 0 + m_Name: Point (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &334296393 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 334296392} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -7, y: 1, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1450998026} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &519551953 GameObject: m_ObjectHideFlags: 0 @@ -259,6 +315,37 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &536701363 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 536701364} + m_Layer: 0 + m_Name: Point (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &536701364 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 536701363} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -5, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1450998026} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &545835880 GameObject: m_ObjectHideFlags: 0 @@ -362,6 +449,68 @@ Canvas: m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 +--- !u!1 &547469733 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 547469734} + m_Layer: 0 + m_Name: Point (3) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &547469734 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 547469733} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -5, y: 1, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1450998026} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &932236989 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 932236990} + m_Layer: 0 + m_Name: Point (6) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &932236990 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 932236989} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -7, y: -3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1450998026} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &969727959 GameObject: m_ObjectHideFlags: 0 @@ -501,6 +650,37 @@ MonoBehaviour: m_EditorClassIdentifier: Assembly-CSharp::GameManager camera: {fileID: 2027968869} pauseMenu: {fileID: 0} +--- !u!1 &1051529129 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1051529130} + m_Layer: 0 + m_Name: Point (4) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1051529130 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051529129} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -7, y: -1, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1450998026} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1258253376 GameObject: m_ObjectHideFlags: 0 @@ -583,6 +763,45 @@ Transform: m_CorrespondingSourceObject: {fileID: 4291108483700617552, guid: e06ef78656b2a6f2192663a7823bd11d, type: 3} m_PrefabInstance: {fileID: 5786297493682315287} m_PrefabAsset: {fileID: 0} +--- !u!1 &1450998025 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1450998026} + m_Layer: 0 + m_Name: SpawnPoints + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1450998026 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1450998025} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1730721400} + - {fileID: 334296393} + - {fileID: 1051529130} + - {fileID: 932236990} + - {fileID: 536701364} + - {fileID: 547469734} + - {fileID: 1810651926} + - {fileID: 1665757569} + m_Father: {fileID: 39988344} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1471730742 GameObject: m_ObjectHideFlags: 0 @@ -962,6 +1181,37 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1665757568 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1665757569} + m_Layer: 0 + m_Name: Point (7) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1665757569 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1665757568} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -5, y: -3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1450998026} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1705796486 GameObject: m_ObjectHideFlags: 0 @@ -1091,6 +1341,68 @@ CircleCollider2D: m_CompositeOrder: 0 m_Offset: {x: 0, y: 0} m_Radius: 0.49999997 +--- !u!1 &1730721399 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1730721400} + m_Layer: 0 + m_Name: Point + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1730721400 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1730721399} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -7, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1450998026} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1810651925 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1810651926} + m_Layer: 0 + m_Name: Point (5) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1810651926 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1810651925} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -5, y: -1, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1450998026} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2027968867 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Microgame/Chemical.cs b/Assets/Scripts/Microgame/Chemical.cs index f0fa9c2..ce01a71 100644 --- a/Assets/Scripts/Microgame/Chemical.cs +++ b/Assets/Scripts/Microgame/Chemical.cs @@ -17,7 +17,6 @@ public class Chemical : MonoBehaviour //we need to detect of the object is overlapping the pot! //i guess doing an overlap circle will work, not too intensive so it doesn't make sense to do anything complex Collider2D isOverlapPot = Physics2D.OverlapPoint(transform.position, potLayer); - Debug.Log(isOverlapPot); if (isOverlapPot) { MarisaPotionMaker.instance.AddChemical(this); diff --git a/Assets/Scripts/Microgame/MarisaPotionMaker.cs b/Assets/Scripts/Microgame/MarisaPotionMaker.cs index eca016b..d31956d 100644 --- a/Assets/Scripts/Microgame/MarisaPotionMaker.cs +++ b/Assets/Scripts/Microgame/MarisaPotionMaker.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using TMPro; using UnityEngine; +using Random = UnityEngine.Random; public class MarisaPotionMaker : MicroGameHandler { @@ -21,6 +22,17 @@ public class MarisaPotionMaker : MicroGameHandler #endregion + public Chemical[] allChemicals; + + [Serializable] + public class ChemicalSpawnPoint //this sucks but whatever! + { + public Transform location; + public bool inUse; + } + public ChemicalSpawnPoint[] chemicalSpawnPoints; + public List chemicalInstances = new(); + public MicrogamePotion[] allPotions; public MicrogamePotion currentPotion; public List requestedPotions = new(); public List completedPotions = new(); @@ -31,7 +43,28 @@ public class MarisaPotionMaker : MicroGameHandler public void StartPotion(MicrogamePotion potionRequested) { - + currentPotion = potionRequested; + foreach (Chemical requestedChemical in potionRequested.chemicals) + { + int index = Random.Range(0, chemicalSpawnPoints.Length); + CreateChemical(requestedChemical,chemicalSpawnPoints[index].location); + chemicalSpawnPoints[index].inUse = true; + } + foreach (ChemicalSpawnPoint spawnpoint in chemicalSpawnPoints) + { + if (spawnpoint.inUse) + { + continue; + } + CreateChemical(allChemicals[Random.Range(0, allChemicals.Length)], spawnpoint.location); + } + } + + public void CreateChemical(Chemical chemicalRequested, Transform location) + { + Chemical newChemical = Instantiate(chemicalRequested, location.position, Quaternion.identity); + newChemical.transform.SetParent(transform); + chemicalInstances.Add(newChemical); } private void Start() @@ -60,6 +93,7 @@ public class MarisaPotionMaker : MicroGameHandler { CompletePotion(currentPotion, true); currentPotionIndex = 0; + StartPotion(allPotions[Random.Range(0, allPotions.Length)]); } } else @@ -71,6 +105,14 @@ public class MarisaPotionMaker : MicroGameHandler public void CompletePotion(MicrogamePotion potion, bool success) { requestedPotions.Remove(potion); //doesn't work if there's multiple of the same potion.... + foreach (Chemical chemicalInstance in chemicalInstances.ToArray()) + { + if (chemicalInstance) + { + Destroy(chemicalInstance); + } + chemicalInstances.Remove(chemicalInstance); + } if (success) { completedPotions.Add(potion);