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); }
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); } }
public NpcPatrolState(FSMSystem fsm, NPC npc) : base(fsm) { StateID = StateID.PatrolState; this.m_npc = npc; }
public NpcChatState(FSMSystem fsm, NpcView npcView) : base(fsm) { StateID = StateID.ChatState; this.mNpcView = npcView; }
private int mFB = 0; //前-1后1 public RunState(FSMSystem fsm, BaseCharacter character) : base(fsm) { StateID = StateID.RunState; this.mCharacter = character; }
public FSMState(FSMSystem fsm) { this.Fsm = fsm; }
public JumpState(FSMSystem fsm, Player character) : base(fsm) { StateID = StateID.JumpState; this.mCharacter = character; mPlayerController = fsm.Owner.GetComponent <CharacterController>(); }
public NpcPatrolState(FSMSystem fsm, NpcView npcView) : base(fsm) { StateID = StateID.PatrolState; this.mNpcView = npcView; }
public NpcChatState(FSMSystem fsm, NPC npc) : base(fsm) { StateID = StateID.ChatState; this.m_npc = npc; }
public NpcIdleState(FSMSystem fsm, NPC npc) : base(fsm) { this.StateID = StateID.IdleState; this.m_npc = npc; }
private int mFB = 0; //前-1后1 public WalkState(FSMSystem fsm, Player character) : base(fsm) { StateID = StateID.WalkState; this.mCharacter = character; }
public NpcIdleState(FSMSystem fsm, NpcView npcView) : base(fsm) { this.StateID = StateID.IdleState; this.mNpcView = npcView; }