/// <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); }
public void InitFSM() { CachEntityAnimation(); m_FSMSystem = new FSMSystem(this, AllowStateChange); m_FSMSystem.OnPerformTransition += this.OnPlayerStateChangedHandle; PlayerIdleState idleState = new PlayerIdleState(); m_FSMSystem.AddState(idleState); PlayerRunState runState = new PlayerRunState(); m_FSMSystem.AddState(runState); PlayerBeAttackedState beAttackedState = new PlayerBeAttackedState(); m_FSMSystem.AddState(beAttackedState); PlayerNormalSkillFireState normalSkillFireState = new PlayerNormalSkillFireState(); m_FSMSystem.AddState(normalSkillFireState); PlayerInitiativeSkillFireState initiativeSkillFireState = new PlayerInitiativeSkillFireState(); m_FSMSystem.AddState(initiativeSkillFireState); InitiativeSkillSelectedState initiativeSkillSelectState = new InitiativeSkillSelectedState(); m_FSMSystem.AddState(initiativeSkillSelectState); m_initiativeSkillSelectedState = initiativeSkillSelectState; PlayerFindPathState findPathState = new PlayerFindPathState(); m_FSMSystem.AddState(findPathState); PlayerDieState playerDieState = new PlayerDieState(); m_FSMSystem.AddState(playerDieState); m_FSMSystem.AddState(new PlayerBeAdsorbState()); m_FSMSystem.AddState(new PlayerScrollSkillFireState()); m_FSMSystem.AddState(new PlayerBeHitFlyState()); m_FSMSystem.AddState(new PlayerStandState()); m_FSMSystem.AddState(new PlayerCastAbilityState()); m_FSMSystem.PerformTransition(Transition.PlayerToIdle); }