Cooker collision
This commit is contained in:
@@ -8,11 +8,26 @@ public class Cooking : MonoBehaviour
|
||||
void GetIngredients()
|
||||
{
|
||||
|
||||
// foreach (GameObject ingredient in currentCollisions) {
|
||||
// Debug.Log(ingredient.name);
|
||||
// }
|
||||
|
||||
return currentCollisions
|
||||
}
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
GetIngredients()
|
||||
GetIngredients();
|
||||
}
|
||||
|
||||
// Keep track of ingredients going on and off the cooker.
|
||||
List <GameObject> currentCollisions = new List <GameObject> ();
|
||||
private void OnTriggerEnter2D(Collider2D other) {
|
||||
currentCollisions.Add (other.gameObject);
|
||||
}
|
||||
private void OnTriggerExit2D(Collider2D other) {
|
||||
currentCollisions.Remove (other.gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user