Added score text

This commit is contained in:
2024-04-09 14:45:07 +02:00
parent c654661e8e
commit d984e0dfe3
4 changed files with 743 additions and 0 deletions

View File

@@ -1,7 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using Microsoft.Unity.VisualStudio.Editor;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class Cooking : MonoBehaviour
{
@@ -14,10 +16,20 @@ public class Cooking : MonoBehaviour
// }
// }
public Vector3 FinishedDishPosition;
public GameObject AllIngredients;
public int requiredScore = 5;
public TextMeshProUGUI UserScoreText;
public TextMeshProUGUI RequredScoreText;
private void Start()
{
UserScoreText.text = "0";
RequredScoreText.text = requiredScore.ToString();
}
public void CreateDish() {
List <GameObject> Ingredients = GetIngredients();
@@ -126,6 +138,8 @@ public class Cooking : MonoBehaviour
gameObject.GetComponent<DishUI>().ShowUI(DishName, DishImage, Stars);
UpdateUserScore(Stars);
}
// Keep track of ingredients going on and off the cooker.
@@ -147,6 +161,10 @@ public class Cooking : MonoBehaviour
}
return Ingredients;
}
private void UpdateUserScore(int score)
{
UserScoreText.text = score.ToString();
}
// void Update()