public void Die() { lock (lock_die) { if (Died) { return; } this.act = Activities.DEAD; } OnUpdate -= e_update; if (AnimationsEnabled) { window.DrawHead -= draw_event; } if (Tick < 60 + Map.StartRoundTime) { MVP.Add(MVPTypes.EARLY_KILL, DisplayKey); } lock (ActiveLock) { ActiveKeys.Remove(this.KeyCode); if (KingOfTheHill) { InactiveKeys.Add(this.KeyCode); } else { InactiveKeys.Insert(0, this.KeyCode); } } key.Die(); tail.Die(); z = 0; DashHideText = false; if (isBounty) { new Animation(pos, 30, HeadR - 1, HeadR - 5, 5, 0, Color.Red, Color.Red, AnimationTypes.CUBED); } isBounty = false; isDoubleBounty = false; if (AnimationsEnabled && ActiveKeys.Count <= 12 && !(Map is BotArena)) { _ = new Animation(pos, 80, 0, W, HeadR, (float)PHI * HeadR, Color.FromArgb(150, this.color), 0); } if (AnimationsEnabled) { _ = new Animation(pos, 12, 0, 0, HeadR, HeadR, this.color, 32, AnimationTypes.CUBED); } else { window.writeln(DisplayKey + " died: " + Points + " pts"); } if (KingOfTheHill) { IKey.UpdateAll(); new Thread(() => { int tick = Tick; SpinWait.SpinUntil(() => Tick >= tick + 120 || Map.phase != Phases.NONE || state == States.NEWGAME || !ApplicationRunning); if (Map.phase != Phases.NONE || state == States.NEWGAME || !ApplicationRunning) { return; } new Coin(IPoint.Center + 3 * IVector.Random(), "3", this.color); SpinWait.SpinUntil(() => Tick >= tick + 180 || Map.phase != Phases.NONE || state == States.NEWGAME || !ApplicationRunning); if (Map.phase != Phases.NONE || state == States.NEWGAME || !ApplicationRunning) { return; } new Coin(IPoint.Center + 3 * IVector.Random(), "2", this.color); SpinWait.SpinUntil(() => Tick >= tick + 240 || Map.phase != Phases.NONE || state == States.NEWGAME || !ApplicationRunning); if (Map.phase != Phases.NONE || state == States.NEWGAME || !ApplicationRunning) { return; } new Coin(IPoint.Center + 3 * IVector.Random(), "1", this.color); SpinWait.SpinUntil(() => Tick >= tick + 300 || Map.phase != Phases.NONE || state == States.NEWGAME || !ApplicationRunning); if (Map.phase != Phases.NONE || state == States.NEWGAME || !ApplicationRunning) { return; } lock (updatinglocker) { this.clear(); this.Revive(); this.act = Activities.DEFAULT; lock (ActiveLock) { ActiveKeys.Add(KeyCode); InactiveKeys.Remove(KeyCode); } this.INVINCIBLE = true; } SpinWait.SpinUntil(() => (Tick >= tick + 360 && !is_about_to_die()) || !ApplicationRunning); this.INVINCIBLE = false; SpinWait.SpinUntil(() => (Tick >= tick + 372 || Died) || !ApplicationRunning); if (Tick <= tick + 372 && Died) { MVP.Flash("Spawnkill!"); } }).Start(); } else { Map.Sort(); IKey.UpdateAll(); if (ActiveKeys.Count == 1 && Map.phase != Phases.ENDROUND) { new Thread(Map.EndRound).Start(); } } if (OnDie != null) { Parallel.Invoke(OnDie); } }