示例#1
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?!?!?!
        }