Files
let-him-cook/Assets/Scripts/Dish.cs
2024-04-03 09:45:30 +02:00

31 lines
638 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Dish : MonoBehaviour
{
public List <GameObject> RequiredIngredients;
public int NutritionalValue = 0;
// Start is called before the first frame update
void Start()
{
if (NutritionalValue > 0) {
return;
}
NutritionalValue = 0;
foreach (GameObject Ingredient in RequiredIngredients) {
int IngredientValue = Ingredient.GetComponent<Ingredient>().NutritionalValue;
NutritionalValue += IngredientValue;
}
}
}