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

@@ -0,0 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CookButton : MonoBehaviour
{
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 30e28733a4100f84e806c42e84c6d4ba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

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();