private void MakeFSM() { mFsmSystem = new SoldierFsmSystem(); SoldierIdleState idleState = new SoldierIdleState(mFsmSystem, this); idleState.AddTransition(SoldierTransition.SeeEnemy, SoldierStateID.Chase); SoldierChaseState chaseState = new SoldierChaseState(mFsmSystem, this); chaseState.AddTransition(SoldierTransition.NoEnemy, SoldierStateID.Idle); chaseState.AddTransition(SoldierTransition.CanAttack, SoldierStateID.Attack); SoldierAttackState attackState = new SoldierAttackState(mFsmSystem, this); attackState.AddTransition(SoldierTransition.NoEnemy, SoldierStateID.Idle); attackState.AddTransition(SoldierTransition.SeeEnemy, SoldierStateID.Chase); mFsmSystem.AddState(idleState, chaseState, attackState); }
public SoldierAttackState(SoldierFsmSystem fsm, ICharacter character) : base(fsm, character) { mStateID = SoldierStateID.Attack; mAttackTimer = mAttackTime; }
public ISoldierState(SoldierFsmSystem fsm, ICharacter character) { mFSM = fsm; mCharacter = character; }
public SoldierChaseState(SoldierFsmSystem fsm, ICharacter character) : base(fsm, character) { mStateID = SoldierStateID.Chase; }