private void Start() { RnL = FindObjectOfType <ReportNLevelManager>(); distractionManager = FindObjectOfType <DistractionManager>(); audioManager = FindObjectOfType <AudioManager>(); answerImage = GameObject.Find("AnswerImage").GetComponent <Image>(); }
// Update is called once per frame void Update() { if (recipeManager.isStart && !isButtonStart && customerSpawn.currentCustomer != null) { hintBtn.SetActive(true); isButtonStart = true; } else if ((!recipeManager.isStart && isButtonStart) || customerSpawn.currentCustomer == null) { hintBtn.SetActive(false); isButtonStart = false; } if (recipeManager.isStart && customerSpawn.currentCustomer != null && showHint) { int count = 1; currentHintFood = customerSpawn.chosenDish; Recipe CorrectRecipeFoods = Resources.Load <Recipe>("recipes/" + currentHintFood); //hintTitleText.text = "Hint of " + CorrectRecipeFoods.ChineseName; //Eng hintTitleText.text = "菜單 " + CorrectRecipeFoods.ChineseName + "的提示"; //Chi for (int i = 0; i < CorrectRecipeFoods.foods.Length; i++) { itemName[i].enabled = true; itemImages[i].enabled = true; itemImages[i].sprite = CorrectRecipeFoods.foods[i].sprite; itemName[i].text = (count + ". " + CorrectRecipeFoods.foods[i].ChineseName + "\n"); //Chi // itemName[i].text = (count + ". " + CorrectRecipeFoods.foods[i].name + "\n"); //Eng count++; } showingTime -= Time.deltaTime; if (showingTime < 0) { hintBtn.SetActive(true); hintFoods.SetActive(false); hintTitleText.enabled = false; showHint = false; emptyRecipe(); } } if (customerSpawn.isCurrentFinished && recipeManager.isStart) { RnL = FindObjectOfType <ReportNLevelManager>(); RnL.usedHintsForEachCustomer.Add(hintCounter); RnL.numOfHintsUsedAfterDistractionHappend.Add(afterDistractionUsedHintCounter); RnL.numOfHintsUsedAfterWrongAnswer.Add(afterWrongUsedHintCounter); Debug.Log("usedhints" + hintCounter); Debug.Log("after dis usedhint" + afterDistractionUsedHintCounter); hintCounter = 0; afterDistractionUsedHintCounter = 0; afterWrongUsedHintCounter = 0; if (distractionManager) { RnL.isDistractionHappendForCustomer.Add(distractionManager.isDistractioHappened); if (distractionManager.isDistractioHappened) { distractionManager.isDistractioHappened = false; } } customerSpawn.isCurrentFinished = false; } if (customerSpawn.isCutomerSpawned) { customerController = FindObjectOfType <CustomerController> (); customerSpawn.isCutomerSpawned = false; } }