private void InitFsm() { m_fsm = new FSMSystem(this.m_npc.TargetGameObject); if (this.m_npc.IsStaticNPC) { NpcIdleState idleState = new NpcIdleState(m_fsm, this.m_npc); idleState.AddTransition(Transition.ReadytoChat, StateID.ChatState); NpcChatState chatState = new NpcChatState(m_fsm, this.m_npc); chatState.AddTransition(Transition.ReadytoIdle, StateID.IdleState); m_fsm.AddStates(idleState, chatState); } else { NpcPatrolState patrolState = new NpcPatrolState(m_fsm, this.m_npc); patrolState.AddTransition(Transition.ReadytoChat, StateID.ChatState); NpcChatState chatState = new NpcChatState(m_fsm, this.m_npc); chatState.AddTransition(Transition.ReadytoPatrol, StateID.PatrolState); m_fsm.AddStates(patrolState, chatState); } }
private void InitFsm() { this.mFsm = new FSMSystem(mPlayer); IdleState idleState = new IdleState(mFsm, this); idleState.AddTransition(Transition.ReadytoWalk, StateID.WalkState); idleState.AddTransition(Transition.ReadytoChat, StateID.ChatState); idleState.AddTransition(Transition.ReadytoJump, StateID.JumpState); idleState.AddTransition(Transition.ReadytoRun, StateID.RunState); WalkState walkState = new WalkState(mFsm, this); walkState.AddTransition(Transition.ReadytoIdle, StateID.IdleState); walkState.AddTransition(Transition.ReadytoChat, StateID.ChatState); walkState.AddTransition(Transition.ReadytoJump, StateID.JumpState); walkState.AddTransition(Transition.ReadytoRun, StateID.RunState); ChatState chatState = new ChatState(mFsm, this); chatState.AddTransition(Transition.ReadytoIdle, StateID.IdleState); JumpState jumpState = new JumpState(mFsm, this); jumpState.AddTransition(Transition.ReadytoIdle, StateID.IdleState); RunState runState = new RunState(mFsm, this); runState.AddTransition(Transition.ReadytoWalk, StateID.WalkState); runState.AddTransition(Transition.ReadytoJump, StateID.JumpState); mFsm.AddStates(idleState, walkState, chatState, jumpState, runState); }