示例#1
0
    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);
    }
示例#2
0
 public SoldierAttackState(SoldierFsmSystem fsm, ICharacter character) : base(fsm, character)
 {
     mStateID     = SoldierStateID.Attack;
     mAttackTimer = mAttackTime;
 }
示例#3
0
 public ISoldierState(SoldierFsmSystem fsm, ICharacter character)
 {
     mFSM       = fsm;
     mCharacter = character;
 }
示例#4
0
 public SoldierChaseState(SoldierFsmSystem fsm, ICharacter character) : base(fsm, character)
 {
     mStateID = SoldierStateID.Chase;
 }