private void Update() { if (!acceptor.DontReceiveAnyInput) { if (acceptor.CanToggleInventory()) { if (Input.GetButtonDown("Inventory")) { GameUI.Instance.ToggleInventory(); } } if (Input.GetButtonDown("Cancel")) { if (GameUI.Instance.uiInventory.open) { GameUI.Instance.uiInventory.ApplyCancel(); } else if (acceptor.MainMenuOpened) { GameSessionManager.Instance.ApplyCancelToMainMenu(); } else if (acceptor.CanToggleMainMenu()) { GameSessionManager.Instance.OpenMainMenu(); } else if (acceptor.ConversationInProgress) { ((HeartRhythmDialogueUI)DialogueManager.DialogueUI).FastForward(); } } if (Input.GetButtonDown("Submit")) { if (acceptor.ConversationInProgress) { ((HeartRhythmDialogueUI)DialogueManager.DialogueUI).FastForward(); } else if (GameUI.Instance.uiInventory.open) { GameUI.Instance.uiInventory.ApplySubmit(); } } int horizontal; int vertical; switch (GameSessionManager.Instance.CurrentGameState) { case GameSessionManager.GameState.Peace when GameSessionManager.Instance.playState == GameSessionManager.PlayState.Basic: horizontal = Mathf.RoundToInt(Input.GetAxisRaw("Horizontal")); vertical = Mathf.RoundToInt(Input.GetAxisRaw("Vertical")); break; case GameSessionManager.GameState.Peace when GameSessionManager.Instance.playState == GameSessionManager.PlayState.DanceMove: case GameSessionManager.GameState.Fight: horizontal = Input.GetButtonDown("Left") ? -1 : Input.GetButtonDown("Right") ? 1 : 0; vertical = Input.GetButtonDown("Down") ? -1 : Input.GetButtonDown("Up") ? 1 : 0; break; default: throw new ArgumentOutOfRangeException(); } var movementDirection = MovementDirectionUtilities.DirectionFromInput(horizontal, vertical); if (movementDirection != MovementDirectionUtilities.MovementDirection.None) { if (acceptor.AcceptInput()) { if (GameLogic.Instance.inputDebugEnabled) { Debug.Log( $"Music: {AudioManager.Instance.musicAudioSource.time}" ); } switch (GameSessionManager.Instance.CurrentGameState) { case GameSessionManager.GameState.Peace: break; case GameSessionManager.GameState.Fight: acceptor.ReceivedInputThisTimeFrame = true; acceptor.FirstBattleInputDone = true; break; default: throw new ArgumentOutOfRangeException(); } Player.Instance.ReceiveInput(movementDirection); switch (GameSessionManager.Instance.CurrentGameState) { case GameSessionManager.GameState.Peace: break; case GameSessionManager.GameState.Fight: ((InGameAudioManager)AudioManager.Instance).ApplyBeat(); break; default: throw new ArgumentOutOfRangeException(); } } else { if (acceptor.FirstBattleInputDone) { switch (GameSessionManager.Instance.CurrentGameState) { case GameSessionManager.GameState.Peace: break; case GameSessionManager.GameState.Fight: if (GameLogic.Instance.inputDebugEnabled) { switch (acceptor.lastWrongInput) { case WrongInputType.InvalidInputTime: Debug.LogError("Invalid Input Time!"); break; case WrongInputType.AlreadyReceivedAnInput: Debug.LogError("Already Received an Input during this Beat!"); break; default: throw new ArgumentOutOfRangeException(); } } Player.Instance.InvalidInputTime(); break; default: throw new ArgumentOutOfRangeException(); } } } } else if (Input.GetKeyDown(KeyCode.Space)) { if (acceptor.AcceptInput()) { if (GameLogic.Instance.inputDebugEnabled) { Debug.Log( $"Music: {AudioManager.Instance.musicAudioSource.time}" ); } if (GameSessionManager.Instance.playState == GameSessionManager.PlayState.DanceMove && SaveSystem.currentGameSave.globalVariables.maxDanceMoveSymbols > 2) { Player.Instance.EndDanceMove(true); } } } } }