public static Shield CopyAndFlip(Shield shield, CoordinateFlipper flipper, Dictionary<int, Entity> flippedEntities) { if (flippedEntities.ContainsKey(shield.Id)) return (Shield) flippedEntities[shield.Id]; var copy = new Shield(shield) { PlayerNumber = shield.PlayerNumber == 1 ? 2 : 1, X = flipper.CalculateFlippedX(shield.X), Y = flipper.CalculateFlippedY(shield.Y) }; flippedEntities.Add(copy.Id, copy); return copy; }
private Shield(Shield shield) : base(shield) { OnDestroyedEvent += OnDestroy; }