Files
let-him-cook/Assets/Scripts/Cooking.cs
magn9775 e0fd0eac43 idk L
2024-03-06 09:25:36 +01:00

49 lines
871 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Cooking : MonoBehaviour
{
private string[] ingrediens = {"L","Egg"};
void GetIngredients()
{
return currentCollisions;
}
void CheckDishes()
{
foreach (GameObject ingredient in currentCollisions) {
Debug.Log(ingredient.name);
}
}
// 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);
}
void Update()
{
GetIngredients();
}
}