45 lines
927 B
C#
45 lines
927 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Cooking : MonoBehaviour
|
|
{
|
|
|
|
private string[] ingrediens = {"L","Egg"};
|
|
|
|
|
|
|
|
void GetIngredients()
|
|
{
|
|
|
|
// foreach (GameObject ingredient in currentCollisions) {
|
|
// Debug.Log(ingredient.name);
|
|
// }
|
|
|
|
return currentCollisions
|
|
}
|
|
|
|
void CheckDishes()
|
|
{
|
|
if (System.Array.IndexOf(ingrediens, "Egg")!=-1){
|
|
print("Egg");
|
|
}
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
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);
|
|
CheckDishes();
|
|
}
|
|
private void OnTriggerExit2D(Collider2D other) {
|
|
currentCollisions.Remove (other.gameObject);
|
|
}
|
|
|
|
}
|