/// <summary> /// ³õʼ»¯×´Ì¬»ú,Ìí¼ÓÖÖ״̬ /// </summary> private void InitFSM() { m_FSMSystem = new FSMSystem(this); PlayerIdleState idleState = new PlayerIdleState(); idleState.AddTransition(Transition.PlayerToIdle, StateID.PlayerIdle); m_FSMSystem.AddState(idleState); PlayerRunState runState = new PlayerRunState(); runState.AddTransition(Transition.PlayerToTarget, StateID.PlayerRun); m_FSMSystem.AddState(runState); PlayerBeAttackedState beAttackedState = new PlayerBeAttackedState(); beAttackedState.AddTransition(Transition.PlayerBeAttacked, StateID.PlayerBeAttacked); m_FSMSystem.AddState(beAttackedState); PlayerNormalSkillFireState normalSkillFireState = new PlayerNormalSkillFireState(); normalSkillFireState.AddTransition(Transition.PlayerFireNormalSkill, StateID.PlayerNormalSkill); m_FSMSystem.AddState(normalSkillFireState); PlayerInitiativeSkillFireState initiativeSkillFireState = new PlayerInitiativeSkillFireState(); initiativeSkillFireState.AddTransition(Transition.PlayerFireInitiativeSkill, StateID.PlayerInitiativeSkill); m_FSMSystem.AddState(initiativeSkillFireState); }
private void Awake() { _player = GetComponent <Player>(); // grounded IdleState = new PlayerIdleState(this, _player); MoveState = new PlayerMoveState(this, _player); JumpState = new PlayerJumpState(this, _player); LandState = new PlayerLandState(this, _player); CrouchState = new PlayerCrouchState(this, _player); CrouchMoveState = new PlayerCrouchMoveState(this, _player); // air AirJumpState = new PlayerAirJumpState(this, _player); FallingState = new PlayerFallingState(this, _player); // wall WallSlideState = new PlayerWallSlideState(this, _player); WallGrabState = new PlayerWallGrab(this, _player); WallClimbState = new PlayerWallClimbState(this, _player); WallJumpState = new PlayerWallJumpState(this, _player); // ledge LedgeClimbState = new PlayerLedgeClimbState(this, _player); // abilities DashState = new PlayerDashState(this, _player); // attacks GroundAttackState = new PlayerGroundAttackState(this, _player); AirAttackState = new PlayerAirAttackState(this, _player); WallAttackState = new PlayerWallAttackState(this, _player); BounceAttackState = new PlayerBounceAttackState(this, _player); }
private void Awake() { instance = this; StateMachine = new PlayerStateMachine(); IdleState = new PlayerIdleState(this, StateMachine, "idle"); MoveState = new PlayerMoveState(this, StateMachine, "move"); JumpState = new PlayerJumpState(this, StateMachine, "inAir"); InAirState = new PlayerInAirState(this, StateMachine, "inAir"); LandState = new PlayerLandState(this, StateMachine, "land"); WallSlideState = new PlayerWallSlideState(this, StateMachine, "wallSlide"); WallJumpState = new PlayerWallJumpState(this, StateMachine, "inAir"); LedgeClimbState = new PlayerLedgeClimbState(this, StateMachine, "ledgeClimbState"); DashState = new PlayerDashState(this, StateMachine, "dash"); SlideState = new PlayerSlideState(this, StateMachine, "slide"); HurtState = new PlayerHurtState(this, StateMachine, "hurt"); SwordComboState = new PlayerSwordComboState(this, StateMachine, "swordCombo"); KnockDownState = new PlayerKnockDownState(this, StateMachine, "knockdown"); GetUpState = new PlayerGetUpState(this, StateMachine, "getUp"); KickComboState = new PlayerKickComboState(this, StateMachine, "kickCombo"); MagicStrongState = new PlayerMagicStrongState(this, StateMachine, "strongCast"); WeakMagicState = new PlayerWeakMagicState(this, StateMachine, "weakCast"); FullPowerMagicState = new PlayerFullPowerMagicState(this, StateMachine, "fullPowerMagicCast"); DeadState = new PlayerDeadState(this, StateMachine, "dead"); FlyingKickState = new PlayerFlyingKickState(this, StateMachine, "flyingKick"); }
public override void InitState() { base.InitState(); { State state = new PlayerIdleState(); state.Init(this); _stateMap[eStateType.IDLE] = state; } { State state = new PathfindingMoveState(); state.Init(this); _stateMap[eStateType.MOVE] = state; } { State state = new PathfindingState(); state.Init(this); _stateMap[eStateType.PATHFINDING] = state; } { State state = new SelectTargetState(); state.Init(this); _stateMap[eStateType.SELECT_TARGET] = state; } _state = _stateMap[eStateType.IDLE]; }
virtual public void InitState() { { State state = new PlayerIdleState(); state.Init(this); _stateMap[eStateType.IDLE] = state; } { State state = new PathfindingMoveState(); state.Init(this); _stateMap[eStateType.MOVE] = state; } { State state = new AttackState(); state.Init(this); _stateMap[eStateType.ATTACK] = state; } { State state = new DamagedState(); state.Init(this); _stateMap[eStateType.DAMAGED] = state; } { State state = new DeadState(); state.Init(this); _stateMap[eStateType.DEAD] = state; } _state = _stateMap[eStateType.IDLE]; }
private void CreateRoleState(int id, StateMechine stateMechine) { PlayerIdleState idleState = new PlayerIdleState(id); PlayerDeadState deadState = new PlayerDeadState(id); PlayerMoveState moveState = new PlayerMoveState(id); PlayerAtkState atkState = new PlayerAtkState(id); stateMechine.RegisterState((int)StateType.IDLE, idleState); stateMechine.RegisterState((int)StateType.DEAD, deadState); stateMechine.RegisterState((int)StateType.MOVE, moveState); stateMechine.RegisterState((int)StateType.ATK, atkState); stateMechine.RegisterEvent((int)StateEvent.EVENT_IDLE, (int)StateType.NENO, (int)StateType.IDLE); stateMechine.RegisterEvent((int)StateEvent.EVENT_IDLE, (int)StateType.IDLE, (int)StateType.IDLE); stateMechine.RegisterEvent((int)StateEvent.EVENT_IDLE, (int)StateType.ATK, (int)StateType.IDLE); stateMechine.RegisterEvent((int)StateEvent.EVENT_IDLE, (int)StateType.MOVE, (int)StateType.IDLE); stateMechine.RegisterEvent((int)StateEvent.EVENT_DEAD, (int)StateType.IDLE, (int)StateType.DEAD); stateMechine.RegisterEvent((int)StateEvent.EVENT_DEAD, (int)StateType.ATK, (int)StateType.DEAD); stateMechine.RegisterEvent((int)StateEvent.EVENT_DEAD, (int)StateType.MOVE, (int)StateType.DEAD); stateMechine.RegisterEvent((int)StateEvent.EVENT_MOVE, (int)StateType.IDLE, (int)StateType.MOVE); stateMechine.RegisterEvent((int)StateEvent.EVENT_MOVE, (int)StateType.ATK, (int)StateType.MOVE); stateMechine.RegisterEvent((int)StateEvent.EVENT_ATK, (int)StateType.IDLE, (int)StateType.ATK); stateMechine.RegisterEvent((int)StateEvent.EVENT_ATK, (int)StateType.MOVE, (int)StateType.ATK); stateMechine.RegisterEvent((int)StateEvent.EVENT_ATK, (int)StateType.ATK, (int)StateType.ATK); }
private void Awake() { StateController = new CharacterStateController(); PlayerIdle = new PlayerIdleState(this, StateController, playerData, "idle"); PlayerMove = new PlayerMoveState(this, StateController, playerData, "moving"); PlayerHide = new PlayerHideState(this, StateController, playerData, "hiding"); }
private void Awake() { IdleState = new PlayerIdleState(this); RunState = new PlayerRunState(this); FightState = new PlayerFightState(this); WinState = new PlayerWinState(this); LoseState = new PlayerLoseState(this); }
private void Awake() { StateMachine = new PlayerStateMachine(); IdleState = new PlayerIdleState(this, StateMachine, playerData); MoveState = new PlayerMoveState(this, StateMachine, playerData); DieState = new PlayerDieState(this, StateMachine, playerData); }
private void Awake() { Instance = this; _startPosition = transform.position; IdleState = new PlayerIdleState(this); AttackState = new PlayerAttackState(this, _damageForSlash, _playerAnimator, _moveSpeed, _targetTransform, _startPosition); }
private void InitStateMachine() { blackboard = new StateBlackboard(); blackboard.Add(BlackboardKey.AttackingFlag, false); blackboard.Add(BlackboardKey.NextAttackFlag, false); blackboard.Add(BlackboardKey.SkillFlag, false); blackboard.Add(BlackboardKey.DamageFlag, false); blackboard.Add(BlackboardKey.RepeatDamageFlag, false); blackboard.Add(BlackboardKey.AnimTrigger, string.Empty); blackboard.Add <Transform>(BlackboardKey.Target, null); blackboard.Add <Vector3>(BlackboardKey.MoveDirection, Vector3.zero); SetAnimTriggerAction setIdleTriggerAction = new SetAnimTriggerAction(blackboard, animator, "Idle"); LookAtTargetAction lookAtAction = new LookAtTargetAction(blackboard, transform); PlayerIdleState idleState = new PlayerIdleState(blackboard, setIdleTriggerAction, lookAtAction); StateNode idleNode = new StateNode(idleState, new Condition(() => { return(true); })); SetAnimTriggerAction setRunTriggerAction = new SetAnimTriggerAction(blackboard, animator, "Move"); SetMoveDirectionAction setMoveDirAction = new SetMoveDirectionAction(blackboard, transform, Camera.main.transform); MoveControllerAction moveControllerAction = new MoveControllerAction(blackboard, GetComponent <CharacterController>(), runSpeed); PlayerMoveState moveState = new PlayerMoveState(blackboard, setRunTriggerAction, setMoveDirAction, moveControllerAction, 100); StateNode moveNode = new StateNode(moveState, new Condition(() => { float horizontal = inputController.GetRuntimeInputConfig().GetBinding(InputBindingName.GAMEPLAY_HORIZONTAL).Value; float vertical = inputController.GetRuntimeInputConfig().GetBinding(InputBindingName.GAMEPLAY_VERTICAL).Value; return(Mathf.Abs(horizontal) > InputConstants.INPUT_DEAD_ZONE || Mathf.Abs(vertical) > InputConstants.INPUT_DEAD_ZONE); })); SetAnimTriggerAction setAttackTrigger = new SetAnimTriggerAction(blackboard, animator, "Attack", true); SetAnimTriggerAction setNextAttackTrigger = new SetAnimTriggerAction(blackboard, animator, "NextAttack", true); PlayerAttackState attackState = new PlayerAttackState(blackboard, setAttackTrigger, setNextAttackTrigger, lookAtAction, 500); StateNode attackNode = new StateNode(attackState, new Condition(() => { return(blackboard.Get <bool>(BlackboardKey.AttackingFlag) == true); })); SetAnimTriggerAction setSkillTrigger = new SetAnimTriggerAction(blackboard, animator, BlackboardKey.AnimTrigger, true); PlayerSkillState skillState = new PlayerSkillState(blackboard, setSkillTrigger, 400); StateNode skillNode = new StateNode(skillState, new Condition(() => { return(blackboard.Get <bool>(BlackboardKey.SkillFlag) == true); })); SetAnimTriggerAction damageAction = new SetAnimTriggerAction(blackboard, animator, "Damage", true); DamageState damageState = new DamageState(blackboard, damageAction, 600); Condition damageCondition = new Condition(() => { return(blackboard.Get <bool>(BlackboardKey.DamageFlag)); }); StateNode damageNode = new StateNode(damageState, damageCondition); DeathState deathState = DeathState.Create(blackboard, animator, "Die", int.MaxValue); StateNode deathNode = new StateNode(deathState, new Condition(() => { return(!self.IsAlive); })); List <StateNode> nodes = new List <StateNode>(); nodes.Add(idleNode); nodes.Add(moveNode); nodes.Add(attackNode); nodes.Add(skillNode); nodes.Add(damageNode); nodes.Add(deathNode); stateMachine = new StateMachine(blackboard, nodes, idleState); }
private void Awake() { StateMachine = new PlayerStateMachine(); IdleState = new PlayerIdleState(this, StateMachine, _playerData, "idle"); MoveState = new PlayerMoveState(this, StateMachine, _playerData, "move"); JumpState = new PlayerJumpState(this, StateMachine, _playerData, "jump"); InAirState = new PlayerInAirState(this, StateMachine, _playerData, "inAir"); LandState = new PlayerLandState(this, StateMachine, _playerData, "land"); }
void Awake() { player = GetComponent <PlayerStats> (); nav = GetComponent <UnityEngine.AI.NavMeshAgent> (); anim = GetComponent <Animator> (); moveState = new PlayerMoveState(this); idleState = new PlayerIdleState(this); chaseState = new PlayerChaseState(this); attackState = new PlayerAttackState(this); }
private void Awake() { StateMachine = new PlayerStateMachine(); IdleState = new PlayerIdleState(this, StateMachine, playerData, "idle"); MoveState = new PlayerMoveState(this, StateMachine, playerData, "move"); JumpState = new PlayerJumpState(this, StateMachine, playerData, "inAir"); InAirState = new PlayerInAirState(this, StateMachine, playerData, "inAir"); LandState = new PlayerLandState(this, StateMachine, playerData, "idle"); DashState = new PlayerDashState(this, StateMachine, playerData, "inAir"); AttackState = new PlayerAttackState(this, StateMachine, playerData, "attack"); }
private void Awake() { StateMachine = new PlayerStateMachine(); IdleState = new PlayerIdleState(this, StateMachine, playerData, "idle"); MoveState = new PlayerMoveState(this, StateMachine, playerData, "move"); JumpState = new PlayerJumpState(this, StateMachine, playerData, "inAir"); InAirState = new PlayerInAirState(this, StateMachine, playerData, "inAir"); LandState = new PlayerLandState(this, StateMachine, playerData, "land"); HurtState = new PlayerHurtState(this, StateMachine, playerData, "hurt"); DeadState = new PlayerDeadState(this, StateMachine, playerData, "dead"); }
private void Start() { // Instantiate states GroundState = new PlayerGroundState(this); JumpingState = new PlayerJumpingState(this); IdleState = new PlayerIdleState(this); // Initialize settings State = GroundState; PreferredMaxSpeed = 50.0f; // Make sure we don't move too fast Health = HealthMax; // Full health Mass = 1; }
private void Awake() { StateMachine = new PlayerStateMachine(); IdleState = new PlayerIdleState(this, StateMachine, playerData, "idle"); MoveState = new PlayerMoveState(this, StateMachine, playerData, "move"); RunState = new PlayerRunState(this, StateMachine, playerData, "run"); JumpState = new PlayerJumpState(this, StateMachine, playerData, "inAir"); LandState = new PlayerLandState(this, StateMachine, playerData, "land"); InAirState = new PlayerInAirState(this, StateMachine, playerData, "inAir"); DoubleJump = new PlayerDoubleJumpState(this, StateMachine, playerData, "doubleJump"); WallSlideState = new PlayerWallSlideState(this, StateMachine, playerData, "wallSlide"); WallJumpState = new PlayerWallJumpState(this, StateMachine, playerData, "inAir"); }
// State override protected void InitState() { base.InitState(); State idleState = new PlayerIdleState(); idleState.Init(this); _stateDic[eState.IDLE] = idleState; State interactionState = new PlayerInterationState(); interactionState.Init(this); _stateDic[eState.INTERACTION] = interactionState; }
private void Awake() { stateMachine = new PlayerStateMachine(); idleState = new PlayerIdleState(this, stateMachine, playerData, "Idle"); moveState = new PlayerMoveState(this, stateMachine, playerData, "Move"); jumpState = new PlayerJumpState(this, stateMachine, playerData, "InAir"); inAirState = new PlayerInAirState(this, stateMachine, playerData, "InAir"); landState = new PlayerLandState(this, stateMachine, playerData, "Land"); dashState = new PlayerDashState(this, stateMachine, playerData, "InAir"); crouchIdleState = new PlayerCrouchIdleState(this, stateMachine, playerData, "IdleCrouch"); crouchMoveState = new PlayerCrouchState(this, stateMachine, playerData, "MoveCrouch"); primAtkState = new PlayerPrimAtkState(this, stateMachine, playerData, "PrimAttack"); }
// State protected override void InitState() { base.InitState(); State idleState = new PlayerIdleState(); idleState.Init(this); _stateDic[eState.IDLE] = idleState; State attackState = new PlayerAttackState(); attackState.Init(this); _stateDic[eState.IDLE] = attackState; }
private void Awake() { rigidbody = GetComponent <Rigidbody>(); rigidbody.freezeRotation = true; rigidbody.useGravity = false; score = mainCamera.GetComponent <Gui> ().score_count; idleState = new PlayerIdleState(this); walkState = new PlayerWalkState(this); bounceState = new PlayerBounceState(this); sneakState = new PlayerSneakState(this); hookState = new PlayerHookState(this); targetState = new PlayerTargetState(this); distToGround = GetComponent <Collider> ().bounds.extents.y; }
private void Awake() { StateMachine = new PlayerStateMachine(); IdleState = new PlayerIdleState(this, StateMachine, playerData, "idle"); MoveState = new PlayerMoveState(this, StateMachine, playerData, "move"); JumpState = new PlayerJumpState(this, StateMachine, playerData, "inAir"); InAirState = new PlayerInAirState(this, StateMachine, playerData, "inAir"); LandState = new PlayerLandState(this, StateMachine, playerData, "land"); WallSlideState = new PlayerWallSlideState(this, StateMachine, playerData, "wallSlide"); WallGrabState = new PlayerWallGrabState(this, StateMachine, playerData, "wallGrab"); WallClimbState = new PlayerWallClimbState(this, StateMachine, playerData, "wallClimb"); WallJumpState = new PlayerWallJumpState(this, StateMachine, playerData, "inAir"); LedgeClimbState = new PlayerLedgeClimbState(this, StateMachine, playerData, "ledgeClimbState"); }
//public Animator animator; private void Awake() { stateMachine = new StateMachine <AlexPlayerController>(this); playerIdleState = new PlayerIdleState(); playerRunningState = new PlayerRunningState(); playerJumpingState = new PlayerJumpingState(); playerFallingState = new PlayerFallingState(); playerAttackingState = new PlayerAttackingState(); stateMachine.ChangeState(playerIdleState); rb = GetComponent <Rigidbody>(); attackHitboxScript = attackHitboxObject.GetComponent <HitBoxController>(); }
public void Start() { _playerInput = GetComponent <PlayerInput>(); _damageComponent = GetComponent <DamageComponent>(); /* Instantiated this way to allow more precise * control over movement via polling. */ moveAction = _playerInput.actions["move"]; maxSpeed = maxWalkingSpeed; walkingState = new PlayerWalkingState(this); boostState = new PlayerBoostState(this); fallState = new PlayerFallState(this); idleState = new PlayerIdleState(this); currentState = walkingState; }
//Whenever the game starts, we will have a state machine created for the player private void Awake() { //Initialise StateMachine = new PlayerStateMachine(); IdleState = new PlayerIdleState(this, StateMachine, playerData, "idle"); MoveState = new PlayerMoveState(this, StateMachine, playerData, "move"); DodgeState = new PlayerDodgeState(this, StateMachine, playerData, "inDodge"); OnLandState = new PlayerOnLandState(this, StateMachine, playerData, "onLand"); InteractState = new PlanetInteractState(this, StateMachine, playerData, "idle"); GameManagement.playerAlive = true; //Set up Anim and bodySprite arrays //Anim = new Animator[angledBodyHeadArray.Length]; //angledBodyHeadArray = new SpriteRenderer[angledLegsArray.Length]; }
private void Awake() { FiniteStateMachine = new PlayerFiniteStateMachine(); SkillManager = new PlayerSkillsManager(); StatsManager = new PlayerStatsManager(_playerStatsData); IdleState = new PlayerIdleState(this, FiniteStateMachine, "idle", _idleStateData); MoveState = new PlayerMoveState(this, FiniteStateMachine, "move", _moveStateData); LandState = new PlayerLandState(this, FiniteStateMachine, "land"); JumpState = new PlayerJumpState(this, FiniteStateMachine, "inAir", _jumpStateData); InAirState = new PlayerInAirState(this, FiniteStateMachine, "inAir", _inAirStateData); WallSlideState = new PlayerWallSlideState(this, FiniteStateMachine, "wallSlide", _wallSlideStateData); WallGrabState = new PlayerWallGrabState(this, FiniteStateMachine, "wallGrab"); WallClimbState = new PlayerWallClimbState(this, FiniteStateMachine, "wallClimb", _wallClimbStateData); WallJumpState = new PlayerWallJumpState(this, FiniteStateMachine, "inAir", _wallJumpStateData); LedgeClimbState = new PlayerLedgeClimbState(this, FiniteStateMachine, "ledgeClimbState", _ledgeClimbStateData); DashState = new PlayerDashState(this, FiniteStateMachine, "inAir", _dashStateData); RollState = new PlayerRollState(this, FiniteStateMachine, "rollState", _rollStateData); CrouchIdleState = new PlayerCrouchIdleState(this, FiniteStateMachine, "crouchIdle", _crouchIdleStateData); CrouchMoveState = new PlayerCrouchMoveState(this, FiniteStateMachine, "crouchMove", _crouchMoveStateData); OnRopeStateAim = new PlayerOnRopeState_Aim(this, FiniteStateMachine, "idle", _onRopeStateData); OnRopeStateAttach = new PlayerOnRopeState_Attach(this, FiniteStateMachine, "inAir", _onRopeStateData); OnRopeStateMove = new PlayerOnRopeState_Move(this, FiniteStateMachine, "inAir", _onRopeStateData); OnRopeStateFinish = new PlayerOnRopeState_Finish(this, FiniteStateMachine, "inAir", _onRopeStateData); SwordAttackState01 = new PlayerSwordAttackState_01(this, FiniteStateMachine, "swordAttack01", _swordAttackPosition01, _swordAttackStateData01); SwordAttackState02 = new PlayerSwordAttackState_02(this, FiniteStateMachine, "swordAttack02", _swordAttackPosition02, _swordAttackStateData02); SwordAttackState03 = new PlayerSwordAttackState_03(this, FiniteStateMachine, "swordAttack03", _swordAttackPosition03, _swordAttackStateData03); FireArrowShotStateStart = new PlayerBowFireArrowShotState_Start(this, FiniteStateMachine, "bowFireShotStart", _fireArrowShotAttackPosition, _fireArrowShotStateData); FireArrowShotStateAim = new PlayerBowFireArrowShotState_Aim(this, FiniteStateMachine, "bowFireShotAim", _fireArrowShotAttackPosition, _fireArrowShotStateData); FireArrowShotStateFinish = new PlayerBowFireArrowShotState_Finish(this, FiniteStateMachine, "bowFireShotFinish", _fireArrowShotAttackPosition, _fireArrowShotStateData); StunState = new PlayerStunState(this, FiniteStateMachine, "stun", StunStateData); DeadState = new PlayerDeadState(this, FiniteStateMachine, "dead", _deadStateData); }
override protected void InitState() { base.InitState(); State attackState = new PlayerAttackState(); attackState.Init(this); _stateDic[eSTATE.ATTACK] = attackState; State moveState = new MoveState(); moveState.Init(this); _stateDic[eSTATE.MOVE] = moveState; State hitState = new PlayerHitState(); hitState.Init(this); _stateDic[eSTATE.HIT] = hitState; State skillOneState = new SkillOne(); skillOneState.Init(this); _stateDic[eSTATE.HIT] = skillOneState; State skillTwoState = new SkillTwo(); skillTwoState.Init(this); _stateDic[eSTATE.HIT] = skillTwoState; State skillThreeState = new SkillThree(); skillThreeState.Init(this); _stateDic[eSTATE.HIT] = skillThreeState; State idleState = new PlayerIdleState(); idleState.Init(this); _stateDic[eSTATE.IDLE] = idleState; }
public CharacterStateMachine(PlayerController player) { _player = player; CharacterState.Init(player); PlayerIdleState idleState = new PlayerIdleState(); PlayerMoveState moveState = new PlayerMoveState(); PlayerAimState aimState = new PlayerAimState(); PlayerAttackingState attackState = new PlayerAttackingState(); idleState.InitTransitions(moveState, aimState); moveState.InitTransitions(idleState, attackState, aimState); aimState.InitTransitions(moveState, attackState, idleState); attackState.InitTransitions(moveState); _allStates.Add(idleState.GetType(), idleState); _allStates.Add(moveState.GetType(), moveState); _currentState = idleState; }
private void Awake() { StateMachine = new PlayerStateMachine(); IdleState = new PlayerIdleState(this, StateMachine, playerData, "idle"); MoveState = new PlayerMoveState(this, StateMachine, playerData, "move"); JumpState = new PlayerJumpState(this, StateMachine, playerData, "inAir"); InAirState = new PlayerInAirState(this, StateMachine, playerData, "inAir"); LandState = new PlayerLandState(this, StateMachine, playerData, "land"); WallClimbState = new PlayerWallClimbState(this, StateMachine, playerData, "wallClimb"); WallGrabState = new PlayerWallGrabState(this, StateMachine, playerData, "wallGrab"); WallSlideState = new PlayerWallSlideState(this, StateMachine, playerData, "wallSlide"); WallJumpState = new PlayerWallJumpState(this, StateMachine, playerData, "inAir"); LedgeClimbState = new PlayerLedgeClimbState(this, StateMachine, playerData, "ledgeClimbState"); DashState = new PlayerDashState(this, StateMachine, playerData, "inAir"); CrouchIdleState = new PlayerCrouchIdleState(this, StateMachine, playerData, "crouchIdle"); CrouchMoveState = new PlayerCrouchMoveState(this, StateMachine, playerData, "crouchMove"); PrimaryAttackState = new PlayerAttackState(this, StateMachine, playerData, "attack"); SecondaryAttackState = new PlayerAttackState(this, StateMachine, playerData, "attack"); }
public void InitializePlayerStateMachine() { idleState = new PlayerIdleState(stateMachine, this, AlfAnimationHash.IDLE_0, playerData); walkState = new PlayerWalkState(stateMachine, this, AlfAnimationHash.RUN_0, playerData); jumpState = new PlayerJumpState(stateMachine, this, AlfAnimationHash.JUMP_0, playerData); inAirState = new PlayerInAirState(stateMachine, this, AlfAnimationHash.INAIR_0, playerData); meleeAttackState = new PlayerMeleeAttackState(stateMachine, this, AlfAnimationHash.ATTACK_0, playerData); parryState = new PlayerParryState(stateMachine, this, AlfAnimationHash.PARRY_1, playerData); rollState = new PlayerRollState(stateMachine, this, AlfAnimationHash.ROLL_0, playerData); stunState = new PlayerStunState(stateMachine, this, AlfAnimationHash.STUN_0, playerData); deadState = new PlayerDeadState(stateMachine, this, AlfAnimationHash.DEAD_0, playerData); takeDamageState = new PlayerTakeDamageState(stateMachine, this, AlfAnimationHash.TAKEDAMAGE_0, playerData); wallState = new PlayerWallState(stateMachine, this, AlfAnimationHash.WALL_0, playerData); dashState = new PlayerDashState(stateMachine, this, AlfAnimationHash.DASH_0, playerData); converseState = new PlayerConverseState(stateMachine, this, AlfAnimationHash.IDLE_0, playerData); cinemaState = new PlayerCinemaState(stateMachine, this, AlfAnimationHash.IDLE_0, playerData); ladderState = new PlayerLadderState(stateMachine, this, AlfAnimationHash.IDLE_0, playerData); InitializePlayerCooldownTimer(); }
public PlayerAnimationSM() { StatesTable["Idle"] = new PlayerIdleState(); StatesTable["Running"] = new PlayerRunningState(); StatesTable["BasicAttack1"] = new PlayerBasicAttack1State(); }
//Unity methods void Awake() { Debug.Log("Player " + playerId + " created."); rend = GetComponentInChildren<Renderer>(); ctrl = GetComponent<CharacterController>(); voxelization = GetComponent<VoxelizationClient>(); spawningState = new PlayerSpawningState(); idleState = new PlayerIdleState(); longIdleState = new PlayerLongIdleState(); movingState = new PlayerMovingState(); dashingState = new PlayerDashingState(); specialState = new PlayerSpecialState(); swingingState = new PlayerSwingingState(); receivingDamageState = new PlayerReceivingDamageState(); fallingState = new PlayerFallingState(); dyingState = new PlayerDyingState(); spawningState.Init(this); idleState.Init(this); longIdleState.Init(this); movingState.Init(this); dashingState.Init(this); specialState.Init(this); swingingState.Init(this); receivingDamageState.Init(this); fallingState.Init(this); dyingState.Init(this); currentState = spawningState; string player = ""; switch (playerId) { case 1: player = "P1"; break; case 2: player = "P2"; break; } moveHorizontal = player + "_Horizontal"; moveVertical = player + "_Vertical"; aimHorizontal = player + "_AimHorizontal"; aimVertical = player + "_AimVertical"; fire = player + "_Fire"; dash = player + "_Dash"; special = player + "_Special"; playerRayCastMask = LayerMask.GetMask(player + "RayCast"); animator = GetComponent<Animator>(); }