Пример #1
0
        public IBlock Build()
        {
            IBlock block = null;

            switch (_type)
            {
            case BlockType.Basic:
                block = new BasicBlock(_configuration, _size);
                break;

            case BlockType.ThreeLives:
                block = new ThreeLivesBlock(_configuration, _size);
                break;

            case BlockType.Irromptable:
                block = new IrromptableBlock(_configuration, _size);
                break;

            case BlockType.FireBallPrize:
                block = new PrizeBlock(_configuration, _size, _componentManager,
                                       _prizeFactory.GetFireBallPrize(_position));
                break;

            case BlockType.ThreeBallsPrize:
                block = new PrizeBlock(_configuration, _size, _componentManager,
                                       _prizeFactory.GetThreeBallsPrize(_position));
                break;

            case BlockType.BasicShooterPrize:
                block = new PrizeBlock(_configuration, _size, _componentManager,
                                       _prizeFactory.GetBasicShooterPrize(_position));
                break;

            case BlockType.WiderSpaceShipPrize:
                block = new PrizeBlock(_configuration, _size, _componentManager,
                                       _prizeFactory.GetWiderSpaceShipPrize(_position));
                break;

            case BlockType.RandomPrize:
                block = new RandomPrizeBlock(_configuration, _size, _componentManager, _prizeFactory);
                break;
            }

            if (_position != null)
            {
                block.Position = _position;
            }

            if (_scale != Vector2.Zero)
            {
                block.Scale = _scale;
            }

            if (_spriteColor != null)
            {
                block.SpriteColor = _spriteColor;
            }
            return(block);
        }
Пример #2
0
 IPrize NewThreeBallsPrize(PrizeFactory prizeFactory)
 {
     return(prizeFactory.GetThreeBallsPrize(Position));
 }