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;
        }
Example #2
0
        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);
        }
Example #3
0
 private AlienFactory(AlienFactory alienFactory) : base(alienFactory)
 {
     OnAddedEvent     += OnAdded;
     OnDestroyedEvent += OnDestroy;
 }
 private AlienFactory(AlienFactory alienFactory)
     : base(alienFactory)
 {
     OnAddedEvent += OnAdded;
     OnDestroyedEvent += OnDestroy;
 }