コード例 #1
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;
        }
コード例 #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);
        }
コード例 #3
0
 private AlienFactory(AlienFactory alienFactory) : base(alienFactory)
 {
     OnAddedEvent     += OnAdded;
     OnDestroyedEvent += OnDestroy;
 }
コード例 #4
0
 private AlienFactory(AlienFactory alienFactory)
     : base(alienFactory)
 {
     OnAddedEvent += OnAdded;
     OnDestroyedEvent += OnDestroy;
 }