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