public override void Init() { base.Init (); m_ColliderLayerMask = 1 << (int)TDCEnum.ELayer.LayerCreature | 1 << (int)TDCEnum.ELayer.LayerEnviroment | 1 << (int)TDCEnum.ELayer.LayerGObject | 1 << (int)TDCEnum.ELayer.LayerItem | 1 << (int)TDCEnum.ELayer.LayerPlayer; var idleState = new FSMIdleState(this); var moveState = new FSMMoveState(this); var findRandomState = new FSMFindRandomState(this); var avoidState = new FSMAvoidState(this); var flyAvoidState = new FSMFlyAvoidState(this); var chaseState = new FSMChaseState(this); var attackState = new FSMAttackState(this); var dieState = new FSMDieState(this); var flyState = new FSMFlyState(this); var landingState = new FSMLandingState(this); var wildModeState = new FSMWildModeState(this); var petModeState = new FSMPetModeState(this); var followState = new FSMFollowState(this); var flyFollowState = new FSMFlyFollowState(this); var flyHomeState = new FSMFlyHomeState(this); var landingHomeState = new FSMLandingHomeState(this); var goHomeState = new FSMGoHomeState(this); m_FSMManager.RegisterState("IdleState", idleState); m_FSMManager.RegisterState("MoveState", moveState); m_FSMManager.RegisterState("FindRandomState", findRandomState); m_FSMManager.RegisterState("AvoidState", avoidState); m_FSMManager.RegisterState("ChaseState", chaseState); m_FSMManager.RegisterState("AttackState", attackState); m_FSMManager.RegisterState("DieState", dieState); m_FSMManager.RegisterState("FlyAvoidState", flyAvoidState); m_FSMManager.RegisterState("FlyState", flyState); m_FSMManager.RegisterState("LandingState", landingState); m_FSMManager.RegisterState("WildModeState", wildModeState); m_FSMManager.RegisterState("PetModeState", petModeState); m_FSMManager.RegisterState("FollowState", followState); m_FSMManager.RegisterState("FlyFollowState", flyFollowState); m_FSMManager.RegisterState("GoHomeState", goHomeState); m_FSMManager.RegisterState("FlyHomeState", flyHomeState); m_FSMManager.RegisterState("LandingHomeState", landingHomeState); m_FSMManager.RegisterCondition("IsActive", GetActive); m_FSMManager.RegisterCondition("MoveToTarget", MoveToTarget); m_FSMManager.RegisterCondition("MoveToEnemy", MoveToEnemy); m_FSMManager.RegisterCondition("FoundEnemy", FoundEnemy); m_FSMManager.RegisterCondition("IsDeath", IsDeath); m_FSMManager.RegisterCondition("IsToFarGroup", IsToFarGroup); m_FSMManager.RegisterCondition("IsToFarStartBattlePosition", IsToFarStartBattlePosition); m_FSMManager.RegisterCondition("IsToFarStartPosition", IsToFarStartPosition); m_FSMManager.RegisterCondition("IsToFarLeaderPosition", IsToFarLeaderPosition); m_FSMManager.RegisterCondition("FoundFood", FoundFood); m_FSMManager.RegisterCondition("IsEnemyDeath", IsEnemyDeath); m_FSMManager.RegisterCondition("IsLandingFinish", IsLandingFinish); m_FSMManager.RegisterCondition("HaveLeader", HaveLeader); m_FSMManager.RegisterCondition("HaveEnemyByLeader", HaveEnemyByLeader); m_FSMManager.RegisterCondition("IsLeaderDeath", IsLeaderDeath); }
protected virtual void LoadFSM() { var startState = new FSMStartSkillState(this); var updateState = new FSMUpdateSkillState(this); var excuteEffectState = new FSMExcuteEffectSkillState(this); var excuteEffectUpdateState = new FSMExcuteEffectUpdateSkillState(this); var moveState = new FSMMoveState(this); var chaseState = new FSMChaseState(this); var endState = new FSMEndSkillState(this); var destroyState = new FSMDestroySkillState(this); m_FSMManager.RegisterState("StartSkillState", startState); m_FSMManager.RegisterState("UpdateSkillState", updateState); m_FSMManager.RegisterState("ExcuteEffectSkillState", excuteEffectState); m_FSMManager.RegisterState("ExcuteEffectUpdateSkillState", excuteEffectUpdateState); m_FSMManager.RegisterState("MoveState", moveState); m_FSMManager.RegisterState("ChaseState", chaseState); m_FSMManager.RegisterState("EndSkillState", endState); m_FSMManager.RegisterState("DestroySkillState", destroyState); m_FSMManager.RegisterCondition("CanActiveSkill", CanActiveSkill); m_FSMManager.RegisterCondition("HaveCreatureAroundOwner", HaveCreatureAroundOwner); m_FSMManager.RegisterCondition("MoveToTarget", MoveToTarget); m_FSMManager.RegisterCondition("MoveToEnemy", MoveToEnemy); m_FSMManager.RegisterCondition("IsFinishSkill", IsFinishSkill); m_FSMManager.RegisterCondition("IsEnemyDeath", IsEnemyDeath); m_FSMManager.RegisterCondition("HaveEndEffectPerTime", HaveEndEffectPerTime); m_FSMManager.RegisterCondition("HaveEndTimeEffect", HaveEndTimeEffect); }
protected override void Start() { m_AIData = new MobInfo(); GameData.Instance.MobInfoTable[3300].CopyTo(m_AIData); m_MaxHp = m_AIData.m_fHp; base.Start(); m_MobAnimator = this.GetComponent <MobAnimationsController>(); m_BodyCollider = this.GetComponent <BoxCollider>(); m_DamageCollider = GetComponentInChildren <CapsuleCollider>(); m_FSM = new FSMSystem(m_AIData); m_AIData.m_Go = this.gameObject; m_AIData.m_FSMSystem = m_FSM; m_AIData.m_AnimationController = this.GetComponent <MobAnimationsController>(); m_AIData.navMeshAgent = this.GetComponent <NavMeshAgent>(); m_AIData.navMeshAgent.speed = Random.Range(11.5f, 12.0f); m_AIData.navMeshAgent.enabled = false; m_AIData.m_SoundManager = m_SoundManager; #region FSMMap FSMRespawnState m_RespawnState = new FSMRespawnState(); FSMChaseState m_Chasestate = new FSMChaseState(); FSMAttackState m_Attackstate = new FSMAttackState(); FSMIdleState m_IdleState = new FSMIdleState(); FSMWanderIdleState m_WanderIdleState = new FSMWanderIdleState(); FSMWanderState m_WanderState = new FSMWanderState(); m_RespawnState.AddTransition(eFSMTransition.Go_WanderIdle, m_WanderIdleState); m_Chasestate.AddTransition(eFSMTransition.Go_Attack, m_Attackstate); m_Attackstate.AddTransition(eFSMTransition.Go_Idle, m_IdleState); m_Attackstate.AddTransition(eFSMTransition.Go_Chase, m_Chasestate); m_IdleState.AddTransition(eFSMTransition.Go_Chase, m_Chasestate); m_IdleState.AddTransition(eFSMTransition.Go_Attack, m_Attackstate); m_WanderIdleState.AddTransition(eFSMTransition.Go_Wander, m_WanderState); m_WanderIdleState.AddTransition(eFSMTransition.Go_Chase, m_Chasestate); m_WanderState.AddTransition(eFSMTransition.Go_WanderIdle, m_WanderIdleState); m_WanderState.AddTransition(eFSMTransition.Go_Chase, m_Chasestate); FSMFishGetHurtState m_GetHurtState = new FSMFishGetHurtState(); FSMDeadState m_DeadState = new FSMDeadState(); m_GetHurtState.AddTransition(eFSMTransition.Go_Chase, m_Chasestate); m_GetHurtState.AddTransition(eFSMTransition.Go_Attack, m_Attackstate); m_DeadState.AddTransition(eFSMTransition.Go_Respawn, m_RespawnState); m_FSM.AddGlobalTransition(eFSMTransition.Go_WanderIdle, m_WanderIdleState); m_FSM.AddGlobalTransition(eFSMTransition.Go_FishGetHurt, m_GetHurtState); m_FSM.AddGlobalTransition(eFSMTransition.Go_Dead, m_DeadState); m_FSM.AddState(m_RespawnState); m_FSM.AddState(m_WanderIdleState); m_FSM.AddState(m_IdleState); m_FSM.AddState(m_Chasestate); m_FSM.AddState(m_Attackstate); m_FSM.AddState(m_GetHurtState); m_FSM.AddState(m_DeadState); m_FSM.AddState(m_WanderState); #endregion }