public override void Update() { base.Update(); if (((MyMatchVariants)Level.Session.MatchSettings.Variants).CrownSummonsChaliceGhost) { if (lastHatState == "UNSET") { lastHatState = HatState.ToString(); } else if (lastHatState != HatState.ToString()) { if (lastHatState != "Crown" && HatState.ToString() == "Crown") { MyChalicePad chalicePad = new MyChalicePad(ActualPosition, 4); MyChalice chalice = new MyChalice(chalicePad); summonedChaliceGhost = new MyChaliceGhost( PlayerIndex, chalice, ((MyMatchVariants)Level.Session.MatchSettings.Variants).ChaliceGhostsHuntGhosts ); Level.Layers[summonedChaliceGhost.LayerIndex].Add(summonedChaliceGhost, false); } else if (summonedChaliceGhost && lastHatState == "Crown" && HatState.ToString() != "Crown") { // Ghost vanishes when player loses the crown summonedChaliceGhost.Vanish(); summonedChaliceGhost = null; } lastHatState = HatState.ToString(); } } }
public override PlayerCorpse Die(DeathCause deathCause, int killerIndex, bool brambled = false, bool laser = false) { if (summonedChaliceGhost) { summonedChaliceGhost.Vanish(); summonedChaliceGhost = null; } if (Level.Session.MatchSettings.Variants.ReturnAsGhosts[this.PlayerIndex] && !this.diedFromPrism) { this.spawningGhost = true; } return(base.Die(deathCause, killerIndex, brambled, laser)); }