public override void onCollide(Entity entity, Game1 game) { if (entity is Player) { Boolean allEnemiesKilled = true; foreach (Entity e in game.entities) { if (e is Enemy) { allEnemiesKilled = false; } } if (allEnemiesKilled) { game.loadLevel(nextLevel); } else { game.showText("The door is still closed!"); } } base.onCollide(entity, game); }
public override void onCollide(Entity entity, Game1 game) { if (entity is Player) { game.showText(text); //game.entities.Remove(this); } }