public override void Execute(Enemy enemy)
 {
     if (enemy.EmptyAmmo())
     {
         enemy.Reload(1);
     }
     else
     {
         enemy.ChangeState(FSMAttacking.Instance());
     }
 }
 public override void Execute(Enemy enemy)
 {
     if (enemy.TargetWithinRange())
     {
         enemy.ChangeState(FSMAttacking.Instance());
     }
     else
     {
         enemy.Approach(1);
     }
 }
Example #3
0
        public Enemy(Vector2 pos, Player target) : base(TextureManager.enemy, pos)
        {
            this.pos    = pos - Offset();
            this.target = target;

            ammoThreshold     = 5;
            healthThreshold   = 30;
            maxAmmo           = 15;
            currAmmo          = 15;
            maxHealth         = 50;
            currHealth        = 50;
            maxDistance       = 300;
            distanceThreshold = 200;

            SetAttackSpeed(15);
            SetReloadSpeed(75);

            fusm         = new FuSM(this);
            currentState = FSMAttacking.Instance();
        }