public BlockBuilder(ComponentManager componentManager, PrizeFactory prizeFactory) { _componentManager = componentManager; _prizeFactory = prizeFactory; _scale = Vector2.Zero; _spriteColor = Color.White; }
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?!?!?! }
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"); }
IPrize NewSlowDownBallPrize(PrizeFactory prizeFactory) { return(prizeFactory.GetSlowDownBallPrize(Position)); }
IPrize NewWiderSpaceShipPrize(PrizeFactory prizeFactory) { return(prizeFactory.GetWiderSpaceShipPrize(Position)); }
IPrize NewThreeBallsPrize(PrizeFactory prizeFactory) { return(prizeFactory.GetThreeBallsPrize(Position)); }
IPrize NewFireBallPrize(PrizeFactory prizeFactory) { return(prizeFactory.GetFireBallPrize(Position)); }
IPrize NewBasicShooterPrize(PrizeFactory prizeFactory) { return(prizeFactory.GetWiderSpaceShipPrize(Position)); }
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); }