Esempio n. 1
0
        private void MakeFSM()
        {
            mSoldierFSMSystem = new SoldierFSMSystem();

            SoldierStateIdle soldierStateIdle = new SoldierStateIdle(mSoldierFSMSystem, this);

            soldierStateIdle.AddTransition(SoldierTransition.SeeEnemy, SoldierStateID.Chase);

            SoldierStateChase soldierStateChase = new SoldierStateChase(mSoldierFSMSystem, this);

            soldierStateChase.AddTransition(SoldierTransition.NoEnemy, SoldierStateID.Idle);
            soldierStateChase.AddTransition(SoldierTransition.CanAttack, SoldierStateID.Attack);

            SoldierStateAttack soldierStateAttack = new SoldierStateAttack(mSoldierFSMSystem, this);

            soldierStateAttack.AddTransition(SoldierTransition.NoEnemy, SoldierStateID.Idle);
            soldierStateAttack.AddTransition(SoldierTransition.SeeEnemy, SoldierStateID.Chase);

            mSoldierFSMSystem.AddState(soldierStateIdle, soldierStateChase, soldierStateAttack);
        }
Esempio n. 2
0
 public SoldierStateChase(SoldierFSMSystem fsm, ICharacter character) : base(fsm, character)
 {
     mStateID = SoldierStateID.Chase;
 }
 public SoldierStateAttack(SoldierFSMSystem fsm, ICharacter character) : base(fsm, character)
 {
     mStateID     = SoldierStateID.Attack;
     mAttackTimer = mAttackTime;
 }
 public ISoldierState(SoldierFSMSystem fsm, ICharacter character)
 {
     mFSM       = fsm;
     mCharacter = character;
 }