void SetAnswerPantsColor() { var pantsValue = UnityEngine.Random.Range(0, Enum.GetNames(typeof(PantsColor)).Length); answerColor = (PantsColor)Enum.ToObject(typeof(PantsColor), pantsValue); AoiCloth.SetPants(answerColor); }
// Start is called before the first frame update void Start() { InitializePants(); if (SceneManager.GetActiveScene().name == "Title") { SetGameState(GameState.Title); } else if (SceneManager.GetActiveScene().name == "Main1") { //correctSE = GetComponent<AudioSource>(); //wrongSE = GetComponent<AudioSource>(); Palette.transform.gameObject.SetActive(false); answerColor = PantsColor.Red; AoiCloth.SetPants(answerColor); SetGameState(GameState.Tutorial); } else if (SceneManager.GetActiveScene().name == "Result") { SetGameState(GameState.Result); resultText.GetComponent <Text>().text = "叫んだ回数 " + answerCount + "回\n" + "勇気 " + voiceScore * 1000; } else if (SceneManager.GetActiveScene().name == "Reward") { AoiCloth.SetPants(answerColor); SetGameState(GameState.Reward); } }
public void InputVoiceString(String voice, float voiceLevel) { if (!IsEnableInput) { return; } Debug.Log(voice); var temp = GetContainColorKanji(voice); Debug.Log(temp); Debug.Log(pants.ContainsKey(temp)); if (!pants.ContainsKey(temp)) { return; } if (pants[temp] == PantsColor.Pants) { Debug.Log("パンツ!"); AoiAniamtor.AoiJump(voiceLevel); return; } PantsColor voicePantsColor = pants[temp]; Debug.Log(answerColor); if (answerColor == voicePantsColor) { AoiAniamtor.AoiNodAnimation(); if (GetGameState() == GameState.Tutorial) { Palette.RemoveColor(voicePantsColor); tutorialText.GetComponent <Text>().text = "正解!"; correctSE.Play(); SetGameState(GameState.Main); //voiceScore = voiceLevel; IsEnableInput = false; neverDone = true; SetAnswerPantsColor(); answerCount = 0; } else if (GetGameState() == GameState.Main) { answerCount++; if (voiceLevel < minCorrectVoiceLevel) { AoiAniamtor.AoiUncallAnimation(); mainText.GetComponent <Text>().text = "聞こえないよ?"; return; } Palette.RemoveColor(voicePantsColor); correctSE.Play(); voiceScore = voiceLevel; SetGameState(GameState.Result); mainText.GetComponent <Text>().text = "正解!"; StartCoroutine(Anten()); } } else { //間違っていた時の処理 Palette.RemoveColor(voicePantsColor); Debug.Log("間違い"); wrongSE.Play(); AoiAniamtor.WrongAnswer(); answerCount++; } }