Finished cooking function
This commit is contained in:
8
Assets/Scripts/CookButton.cs
Normal file
8
Assets/Scripts/CookButton.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CookButton : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
11
Assets/Scripts/CookButton.cs.meta
Normal file
11
Assets/Scripts/CookButton.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30e28733a4100f84e806c42e84c6d4ba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user