private void Update() { // We don't do anything else if we are busy in the dressing room if (_playerMoveState == PlayerMoveState.BusyDressing) { return; } // We don't do anything else if we are inside a vehicle if (_player.PlayerVehicle.BusyWithVehicle) { _playerMoveState = PlayerMoveState.BusyWithVehicle; return; } // If we are wall running, we don't have to check for other states if (GameManager.Instance.InputManager.Rushing && IsBusyWithWall && _player.PlayerWallRun.CanWallRun && Mathf.Abs(GameManager.Instance.InputManager.Horizontal) > 0) { _playerMoveState = PlayerMoveState.WallRunning; return; } else { // If we aren't wall running anymore, but were in wall running mode, then we try to climb again if possible, or go back to normal mode if (_playerMoveState == PlayerMoveState.WallRunning && _player.PlayerWallRun.CanWallRun) { // If we stopped wall running, but we were in the wall run state and can still potentially wall run (means we have something to climb on) // We go back to climbing _player.PlayerWallRun.BackToClimb(); _playerMoveState = PlayerMoveState.WallClimbing; } // We go back to current mode when we aren't wall running or wall climbing if (_playerMoveState != PlayerMoveState.WallClimbing && _playerMoveState != PlayerMoveState.InteractingWithItem) { _playerMoveState = _modes[_currentMode].DefaultMoveState; } } // We only listen to changes in move state when we aren't busy with wall and when we aren't using an item // And when we aren't recovering energy if (_playerMoveState != PlayerMoveState.WallClimbing && _playerMoveState != PlayerMoveState.WallRunning && _playerMoveState != PlayerMoveState.InteractingWithItem && !_player.PlayerStatus.IsRecoveringEnergy) { if (GameManager.Instance.InputManager.Rushing) { _playerMoveState = _modes[_currentMode].RushMoveState; } else { _playerMoveState = _modes[_currentMode].DefaultMoveState; } } // Preparing and unpreparing weapon if (GameManager.Instance.InputManager.PreparedOrUnprepareWeapon && !IsBusyWithWall && !_player.PlayerPickAnimator.HoldingItem) { if (_playerWeaponState != PlayerWeaponState.Prepared && _player.PlayerWeapons.EquippedWeaponMount != null && _player.PlayerWeapons.EquippedWeaponMount.Weapon.WeaponType != WeaponType.Hands) { _playerWeaponState = PlayerWeaponState.Prepared; } else { _playerWeaponState = PlayerWeaponState.Unprepared; } } // Begin Climb // Can't climb if we are holding an item // Can't climb if we are recovering energy if (GameManager.Instance.InputManager.WallClimb && !_player.PlayerPickAnimator.HoldingItem && !_player.PlayerStatus.IsRecoveringEnergy) { if (_playerMoveState != PlayerMoveState.WallClimbing && _player.PlayerWallClimb.CanBeginClimb) { _playerWeaponState = PlayerWeaponState.Unprepared; _playerMoveState = PlayerMoveState.WallClimbing; _player.PlayerWallClimbAnimator.StartClimb(); } else { if (_playerMoveState == PlayerMoveState.WallClimbing) { _player.AnimatorSounds.PlayJumpSound(); _player.PlayerAnimator.Animator.SetTrigger("StopWallClimbing"); } _playerMoveState = _modes[_currentMode].DefaultMoveState; } } // Change Move State if (GameManager.Instance.InputManager.ChangeMode) { _currentMode++; if (_currentMode >= _modes.Count) { _currentMode = 0; } } // Forcing states when tired (recovering energy) if (_player.PlayerStatus.IsRecoveringEnergy) { _currentMode = 0; if (IsMakingEffort) { _playerMoveState = PlayerMoveState.Walking; } } }
public void UnprepareWeapon() { _playerWeaponState = PlayerWeaponState.Unprepared; }