private void MakeFSM() { mFSMSys = new SoldierFSMSys(); SoldierChaseState chaseState = new SoldierChaseState(mFSMSys, this); chaseState.AddTransition(SoldierTransition.CanAttack, SoldierStateID.Attack); SoldierAttackState attackState = new SoldierAttackState(mFSMSys, this); attackState.AddTransition(SoldierTransition.LostSoldier, SoldierStateID.Chase); mFSMSys.AddState(chaseState, attackState); }
/// <summary> /// 构造函数 /// </summary> /// <param name="fsm"></param> /// <param name="character"></param> public ISoldierState(SoldierFSMSys fsm, ICharacter character) { mFSM = fsm; mCharacter = character; }
public SoldierAttackState(SoldierFSMSys fsm, ICharacter c) : base(fsm, c) { mStateID = SoldierStateID.Attack; mAttackTimer = mAttackTime; }
public SoldierChaseState(SoldierFSMSys fsm, ICharacter c) : base(fsm, c) { mStateID = SoldierStateID.Chase; }