void ChooseNewRecipe() { if (recipies.Count < 1) { gameManager.GameOver(); gameManager.NameEng.text = "You Won!"; } else { currentRecipe = recipies[Random.Range(0, recipies.Count)]; recipies.Remove(currentRecipe); UpdateUI(); } }
void Start() { recipies = new List <SushiRecipe>(); SushiRecipe[] allRecipies = GetComponentsInChildren <SushiRecipe>(); foreach (SushiRecipe rec in allRecipies) { recipies.Add(rec); } currentRecipe = recipies[Random.Range(0, recipies.Count)]; print(currentRecipe.recipe[0]); print(currentRecipe.recipe[1]); print(currentRecipe.recipe[2]); recipies.Remove(currentRecipe); UpdateUI(); }
IEnumerator ShowSushiImageAndPauseTheGame(SushiRecipe rec) { CancelInvoke(); Player.SetActive(false); FinalImage.gameObject.SetActive(true); FinalImage.sprite = rec.FinalImage; NameEng.gameObject.SetActive(true); NameEng.text = rec.Name; NameJp.gameObject.SetActive(true); NameJp.text = rec.JpName; yield return(new WaitForSeconds(3f)); Player.SetActive(true); FinalImage.gameObject.SetActive(false); NameEng.gameObject.SetActive(false); NameJp.gameObject.SetActive(false); InvokeRepeating("SpawnPieces", 1f, 1.2f); }
public void SushiCompleted(SushiRecipe rec) { StartCoroutine(ShowSushiImageAndPauseTheGame(rec)); }