Beispiel #1
0
        public PowerUp(int x, int y, char character = DisplayCharacter, bool isBacktrackingPowerUp = false, int healthBoost = 0, int strengthBoost = 0, int defenseBoost = 0, int visionBoost = 0, PowerUp pairedTo = null)
            : base(x, y, DisplayCharacter, Palette.White)
        {
            this.Character             = character;
            this.HealthBoost           = healthBoost;
            this.StrengthBoost         = strengthBoost;
            this.DefenseBoost          = defenseBoost;
            this.VisionBoost           = visionBoost;
            this.IsBacktrackingPowerUp = isBacktrackingPowerUp;

            // Serializer passes in this value, production code doesn't. Sometimes. (Not for both paired entities.)
            // Additional bug found in https://trello.com/c/XU4p02Lk/135-power-ups-behind-a-chasm-arent-paired-if-you-load-game
            // Always pair symmetrically; not doing so, creates an assymetric relationship.
            if (pairedTo != null)
            {
                PowerUp.Pair(this, pairedTo);
            }
        }
Beispiel #2
0
 public static void Pair(PowerUp p1, PowerUp p2)
 {
     p1.PairedTo = p2;
     p2.PairedTo = p1;
 }