private void OnPlayerDeath(object sender, DeadPlayerEventArgs args) { if (this.players.Remove(args.playerToRemove)) { this.logger.Log(string.Format(PlayerDead, args.playerToRemove.Name, args.killerName)); switch (args.playerToRemove.ClassType) { case Enums.ClassType.Mage: IMageSkills mageToRemove = this.mages.SingleOrDefault(m => m.Name == args.playerToRemove.Name); this.mages.Remove(mageToRemove); break; case Enums.ClassType.Rogue: IRogueSkills rogueToRemove = this.rogues.SingleOrDefault(r => r.Name == args.playerToRemove.Name); this.rogues.Remove(rogueToRemove); break; case Enums.ClassType.Warrior: IWarriorSkills wariorToRemove = this.warriors.SingleOrDefault(w => w.Name == args.playerToRemove.Name); this.warriors.Remove(wariorToRemove); break; default: break; } } }
public void HandleOtherPlayerAttack(int otherPlayerAttackPoints, string otherPlayerName) { this.DeffencePoints -= otherPlayerAttackPoints; if (this.DeffencePoints < 0) { this.HealthPoints += this.DeffencePoints; this.DeffencePoints = 0; } if (this.HealthPoints <= 0) { DeadPlayerEventArgs args = new DeadPlayerEventArgs(this, otherPlayerName); this.playerDeath(this, args); } }
private void OnTriggerDeadPlayer(object sender, DeadPlayerEventArgs e) { MessageBox.Show($"The {e.Player.Civilization.Name} civilization has been defeated by the {e.Killer.Civilization.Name} !", "ErsatzCiv"); }