added tutorial, fixed score UI
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ public class DishUI : MonoBehaviour
|
||||
public GameObject _4Stars;
|
||||
public GameObject _5Stars;
|
||||
float Timer = 0;
|
||||
public float MaxTimer = 3;
|
||||
bool IsVisible = false;
|
||||
|
||||
private void Start() {
|
||||
|
||||
34
Assets/Scripts/Tutorial.cs
Normal file
34
Assets/Scripts/Tutorial.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Experimental.GlobalIllumination;
|
||||
|
||||
public class Tutorial : MonoBehaviour
|
||||
{
|
||||
float timer = 0;
|
||||
public float TutorialTime = 7;
|
||||
public GameObject Darkness;
|
||||
public GameObject levelUI;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
Darkness.SetActive(true);
|
||||
levelUI.SetActive(false);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
timer += Time.deltaTime;
|
||||
|
||||
if (timer >= TutorialTime)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
Darkness.SetActive(false);
|
||||
levelUI.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Tutorial.cs.meta
Normal file
11
Assets/Scripts/Tutorial.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d880255042653a44abf0f2e4a26d8ac
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user