示例#1
0
 public void collideWith(Enemy e)
 {
     if (e != null)
     {
         e.health -= damagePerSecond;
         if (e.health <= 0)
         {
             e.dieFromHero(hero);
         }
     }
 }
示例#2
0
 public override void AffectEnemy(Enemy e, float secondsPassed)
 {
     e.hitBy(hero, DAMAGE_PER_SECOND * secondsPassed);
 }
示例#3
0
 public override void AffectEnemy(Enemy e, float secondsPassed)
 {
     e.globalMoveSpeedMultiplier -= SLOWING_FACTOR;
 }
示例#4
0
 public EnemyMemento(Enemy target)
 {
     Target = target;
     state = target.state;
     AItarget = target.targetedAI.Target;
     position = target.position;
     health = target.health;
     direction = target.direction;
     rotation = target.rotation;
     dying = target.dying;
     deathEmitterMemento = target.deathEmitter.GenerateMementoFromCurrentFrame();
 }
示例#5
0
 public void hitBy(Enemy e, float damage)
 {
     if (RetroGame.INVINCIBILITY)
         return;
     health -= damage;
     if (health <= 0)
     {
         if (attemptDie())
         {
             playerPrisoner = new PlayerPrisoner(this, levelX, levelY, tileX, tileY);
             RetroGame.EscapeScreen.levelManager.levels[levelX, levelY].prisoners.Add(playerPrisoner);
             return;
         }
     }
     SoundManager.PlaySoundOnce("PlayerHit", playInReverseDuringReverse: true);
     flashWithColor(Color.Red.withAlpha(150), 2, 0.5f);
 }
示例#6
0
 // What does this shield do to the enemy?
 public abstract void AffectEnemy(Enemy e, float secondsPassed);
示例#7
0
        public void collideWith(Enemy e)
        {
            if (e != null)
            {
                if (dying)
                    return;
                e.hitBy(gunPowerup.hero, damage);
                SoundManager.PlaySoundOnce("EnemyHit", playInReverseDuringReverse: true);
                if (phasing)
                    enemiesAlreadyHit.Add(e);
            }

            if (phasing && e == null)
            {
            }
            else
            {
                explosionEmitter.position = position;
                explosionEmitter.particlesEmitted = 0;
                explosionEmitter.active = true;
                trailEmitter.active = false;
            }

            if (!phasing)
            {
                dying = true;
            }
        }