public void collideWith(Enemy e) { if (e != null) { e.health -= damagePerSecond; if (e.health <= 0) { e.dieFromHero(hero); } } }
public override void AffectEnemy(Enemy e, float secondsPassed) { e.hitBy(hero, DAMAGE_PER_SECOND * secondsPassed); }
public override void AffectEnemy(Enemy e, float secondsPassed) { e.globalMoveSpeedMultiplier -= SLOWING_FACTOR; }
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(); }
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); }
// What does this shield do to the enemy? public abstract void AffectEnemy(Enemy e, float secondsPassed);
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; } }