Finished cooking function

This commit is contained in:
2024-03-12 15:34:00 +01:00
parent b213c4ef42
commit 25ef87c512
9 changed files with 201 additions and 12 deletions

View File

@@ -14,6 +14,8 @@ public class Cooking : MonoBehaviour
// }
public Vector3 FinishedDishPosition;
void CreateDish() {
List <GameObject> Ingredients = GetIngredients();
@@ -74,12 +76,19 @@ public class Cooking : MonoBehaviour
}
}
Debug.Log(BestDish.name);
// Remove ingredients and add the dish
foreach (GameObject Ingredient in Ingredients) {
Transform transform = Ingredient.GetComponent<Ingredient>().transform;
transform.position = Vector3.up * 50;
}
BestDish.transform.position = FinishedDishPosition;
}
// Keep track of ingredients going on and off the cooker.
List <GameObject> currentCollisions = new List <GameObject> ();
List <GameObject> currentCollisions = new List <GameObject>();
private void OnTriggerEnter2D(Collider2D other) {
currentCollisions.Add (other.gameObject);
CreateDish();