public void TimeOut() { if (false) { GameObject mengnan_value = GameObject.Find("MengNanValue"); MengNanValue mengnan_component = mengnan_value.GetComponent <MengNanValue>(); int value = mengnan_component.GetValue(); mengnan_component.SetValue(value - 10); } { // Debug.Log("it should ask next question"); // GameObject go = GameObject.Find("Question Panel"); // 使用 GameObject.Find 有可能找到的是 prefab,而非场景中的对象 m_master_ai.set_state(MyConst.ACTION_STATE_ANSWER_TIMEOUT); // QuestionController component = questionCtrl; // component.AskQuestion(); //StartTheWatch(); } }
void SelectAnswer(int i) { var mengNan = currentMengNanValue.GetValue(); if (currentAnswers.Count > i) { if (currentAnswers[i].cost <= mengNan) { answersGroup.HideWithoutAnswer(i); questionDialog.idle = false; Debug.Log($"execute answer: {currentAnswers[i].answer}"); // currentAnswers[i].Execute(currentMengNanValue, currentInterviewScore); audioSource.clip = answerSFX; audioSource.Play(); if (false == currentAnswers[i].isMacho) { m_master_ai.set_isMacho(false); } m_master_ai.incr_mengnan_value(-1 * currentAnswers[i].cost); m_master_ai.incr_score(currentAnswers[i].score); // m_master_ai.incr_score( -100 ); if (0 == currentAnswers[i].reaction) { m_master_ai.set_state(MyConst.ACTION_STATE_MASTER_DISAGREE); } else if (1 == currentAnswers[i].reaction) { m_master_ai.set_state(MyConst.ACTION_STATE_REVIEW_ANSWER); } else if (2 == currentAnswers[i].reaction) { m_master_ai.set_state(MyConst.ACTION_STATE_MASTER_AGREE); } return; } } Debug.Log($"unable to execute answer"); audioSource.clip = unableToAnswerSFX; audioSource.Play(); }