public bool HasState(IAdventurePlayer player, string state) { if (PlayerItemState.ContainsKey(player.Id)) { var states = PlayerItemState[player.Id]; if (states.Contains(state)) { return(true); } } return(false); }
private void Awake() { _stateMachine = new PlayerStateMachine(); CombatController = new CombatController(); IdleState = new PlayerIdleState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_IDLE_2_HASH); MoveState = new PlayerMoveState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_RUN_2_HASH); JumpState = new PlayerJumpState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_JUMP_HASH); InAirState = new PlayerInAirState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_AIR_HASH); LandState = new PlayerLandState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_LAND_HASH); WallSlideState = new PlayerWallSlideState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_WALL_SLIDING_HASH); LedgeClimbState = new PlayerLedgeClimbState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_LEDGE_GRAB_HASH); LedgeJumpState = new PlayerLedgeJumpState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_LEDGE_JUMP_HASH); CrouchIdleState = new PlayerCrouchIdleState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_CROUCH_IDLE_HASH); CrouchMoveState = new PlayerCrouchMoveState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_CROUCH_WALK_HASH); SwordAttackState = new PlayerSwordAttackState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_ATTACK_1_HASH, 3); HandAttackState = new PlayerHandAttackState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_PUNCH_1_HASH, 5); AirAttackState = new PlayerAirAttackState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_AIR_ATTACK_1_HASH, 2); SlideState = new PlayerSlideState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_SLIDE_HASH); ItemState = new PlayerItemState(this, _stateMachine, _playerData, AnimationConstants.PLAYER_USE_ITEM_HASH); }