private void CheckGamepadInput() { var inputs = TFC.GamepadInputHandler.GetActionsOnly(); var trialInputs = TFC.GamepadInputHandler.GetColorInputs(); if (resetedToNeutral) { if (gameMode == UDC.GameMode.Trial) { if (trialInputs.Count != 0) { if (trialInputs.Contains(trialInputList[currentCommand])) { resetedToNeutral = false; AddScoreByCommandIndex(currentCommand); SoundMgr.PlayVolSe("UDCCorrectCommand", 1.0f, 2); commandObjects[currentCommand].GetComponentInChildren <Animator>().Play("Popup"); commandObjects[currentCommand].GetComponent <CommandManager>().GetParticles().GetComponent <GameParticles>().PlayParticles(); currentCommand++; } else { MissCommand(); resetedToNeutral = false; } } } else if (gameMode == UDC.GameMode.Challenge) { if (inputs.Count != 0) { if (inputs.Contains(inputList[currentCommand])) { resetedToNeutral = false; AddScoreByCommandIndex(currentCommand); SoundMgr.PlayVolSe("UDCCorrectCommand", 1.0f, 2); commandObjects[currentCommand].GetComponentInChildren <Animator>().Play("Popup"); commandObjects[currentCommand].GetComponent <CommandManager>().GetParticles().GetComponent <GameParticles>().PlayParticles(); currentCommand++; } else { MissCommand(); resetedToNeutral = false; } } } } else { if (inputs.Count == 0) { resetedToNeutral = true; } } }
void Update() { if (!init) { Init(); } if (!isPaused) { if (onStandby) { standbyCanvas.SetActive(true); } UpdateDisplayTime(); UpdateScoreText(); if (currentCommand == 0 && (currentCommand != previousFrameCommand)) { GenerateRandomCommands(); } UpdateCommandIcons(currentCommand); previousFrameCommand = currentCommand; if (Input.GetAxis("Pause") == 0) { isPauseReleased = true; } if ((Input.GetAxis("Pause") == 1) && isPauseReleased) { isPaused = true; standbyCanvasLastState = standbyCanvas.activeSelf; standbyCanvas.GetComponent <MSMM.MenuSelector>().Reset(); standbyCanvas.SetActive(false); pauseCanvas.SetActive(true); pauseCanvas.GetComponent <PauseMenu>().SetButtonState(); } if (!onStandby && !gameEnded) { if (waitingAnimation) { var radish = commandObjects[currentCommand].GetComponent <CommandManager>().GetRadish(); if (waitingTime >= 0.167f && !missSEPlayed) { SoundMgr.PlayVolSe("UDCMissCommand", 1.0f, 3); missSEPlayed = true; } if (radish.GetComponent <RectTransform>().anchoredPosition.y >= 150) { GenerateRandomCommands(); currentCommand = 0; waitingAnimation = false; } waitingTime += Time.deltaTime; } else { CheckGamepadInput(); ResetCurrentCommand(); } currentWaitTime -= Time.deltaTime; } } if (isPaused) { if (!pauseCanvas.activeSelf) { isPaused = false; isPauseReleased = false; standbyCanvas.SetActive(standbyCanvasLastState); } } if (currentWaitTime <= 0) { gameEnded = true; currentWaitTime = 0; UICanvas.SetActive(false); } if (gameEnded) { if (!endSEPlayed) { SoundMgr.StopBgm(); SoundMgr.PlayVolSe("UDCGameEnd", 1.0f); endSEPlayed = true; } SpecialModeCanvas.SetActive(true); SpecialModeCanvas.GetComponent <SpecialModeTransition>().Execute(); MSMM.RankingTempData.TempScore = (uint)score; UDC.SpecialModeData.Time = correctCommands; StartCoroutine(LateReset(3)); SoundMgr.StopBgm(); } }