added tutorial, fixed score UI

This commit is contained in:
2024-04-17 09:08:27 +02:00
parent 299d85e236
commit 335905a543
5 changed files with 419 additions and 7 deletions

View File

@@ -17,14 +17,17 @@ public class Cooking : MonoBehaviour
// }
// }
public Vector3 FinishedDishPosition;
public GameObject AllIngredients;
public GameObject LevelManager;
private List<GameObject> DishesCooked = new List<GameObject>(); // stop user from cooking same dish twice.
private float timer = 0;
private float MaxTimer = 0;
int NV;
private void Start() {
MaxTimer = GetComponent<DishUI>().MaxTimer;
}
public void CreateDish() {
List <GameObject> Ingredients = GetIngredients();
@@ -144,9 +147,9 @@ public class Cooking : MonoBehaviour
gameObject.GetComponent<DishUI>().ShowUI(DishName, DishImage, Stars);
int NV = BestDish.GetComponent<Dish>().NutritionalValue;
LevelManager.GetComponent<LevelManager>().UpdateUserScore(NV);
LevelManager.GetComponent<LevelManager>().CompareScores();
timer = MaxTimer;
}
// Keep track of ingredients going on and off the cooker.
@@ -191,6 +194,14 @@ public class Cooking : MonoBehaviour
return stars;
}
}
private void Update() {
if (timer < 0)
{
LevelManager.GetComponent<LevelManager>().CompareScores();
timer = 0;
}
if (timer > 0)
timer -= Time.deltaTime;
}
}