Esempio n. 1
0
 public BlockBuilder(ComponentManager componentManager, PrizeFactory prizeFactory)
 {
     _componentManager = componentManager;
     _prizeFactory     = prizeFactory;
     _scale            = Vector2.Zero;
     _spriteColor      = Color.White;
 }
Esempio n. 2
0
        public void LoadBoard(BoardDefinition boardDefinition)
        {
            //Aqui tengo que procesar alguna estructura que me diga los bloques
            //Construyo una lista de bloques ya con los observables, etc y se la enchufo al board
            List <IBlock> blocks            = new List <IBlock>();
            List <IBlock> irromptableBlocks = new List <IBlock>();
            var           shooterFactory    = new ShooterFactory(Configuration, _resourceRepository, SpaceShip);
            var           prizeFactory      = new PrizeFactory(this, _resourceRepository, shooterFactory);

            BlockBuilder builder = new BlockBuilder(this, prizeFactory);

            builder.Configuration(Configuration);

            foreach (BlockDefinition blockDefinition in boardDefinition.BloksDefinition)
            {
                var block = builder.Position(blockDefinition.Position).Type(blockDefinition.Type).Build();
                AddBlock(block);
                blocks.Add(block);
            }

            foreach (BlockDefinition blockDefinition in boardDefinition.IrromptableBlocksDefinition)
            {
                var block = builder.Position(blockDefinition.Position).Type(blockDefinition.Type).Build();
                AddBlock(block);
                irromptableBlocks.Add(block);
            }

            Board = new Board(blocks, irromptableBlocks, Configuration.ScreenSize, Balls[0].Size.Width * Balls[0].Scale.X); //Y si quiero bolas mas grandes?!?!?!
        }
Esempio n. 3
0
        internal static AbstractBoardTile GetTile(TileInfo info, Vector position)
        {
            switch (info.TileType)
            {
            case TileTypes.WALKABLE:
                return(new WalkableBoardTile(position, PrizeFactory.GetPrize(info.PrizeType, position), info.ForbiddenMovement));

            case TileTypes.BLOCKER:
                return(new BlockerBoardTile(position));

            case TileTypes.DOOR:
                return(new DoorBoardTile(info.doorOutDirection, position));
            }

            throw new PacException($"Tile of type {info.TileType} is not implemented in TileFactory.GetTile");
        }
Esempio n. 4
0
 IPrize NewSlowDownBallPrize(PrizeFactory prizeFactory)
 {
     return(prizeFactory.GetSlowDownBallPrize(Position));
 }
Esempio n. 5
0
 IPrize NewWiderSpaceShipPrize(PrizeFactory prizeFactory)
 {
     return(prizeFactory.GetWiderSpaceShipPrize(Position));
 }
Esempio n. 6
0
 IPrize NewThreeBallsPrize(PrizeFactory prizeFactory)
 {
     return(prizeFactory.GetThreeBallsPrize(Position));
 }
Esempio n. 7
0
 IPrize NewFireBallPrize(PrizeFactory prizeFactory)
 {
     return(prizeFactory.GetFireBallPrize(Position));
 }
Esempio n. 8
0
 IPrize NewBasicShooterPrize(PrizeFactory prizeFactory)
 {
     return(prizeFactory.GetWiderSpaceShipPrize(Position));
 }
Esempio n. 9
0
        public RandomPrizeBlock(IGameConfiguration configuration, Size size, ComponentManager componentManager, PrizeFactory prizeFactory) : base(configuration, size, componentManager, null)
        {
            Dictionary <Type, ReturnPrize> returningPrizes = new Dictionary <Type, ReturnPrize>
            {
                { typeof(BasicShooterPrize), NewBasicShooterPrize },
                { typeof(FireBallPrize), NewFireBallPrize },
                { typeof(ThreeBallsPrize), NewThreeBallsPrize },
                { typeof(WiderSpaceShipPrize), NewWiderSpaceShipPrize },
                { typeof(SlowDownBallPrize), NewSlowDownBallPrize }
            };

            List <Type> types = new List <Type>(returningPrizes.Keys);

            var rnd          = new Random();
            int randomNumber = rnd.Next(returningPrizes.Count);

            //Aqui juego con el azarrrrrr
            Prize = returningPrizes[types[randomNumber]](prizeFactory);
        }