Beispiel #1
0
 public Block(BlockType type, Position position)
 {
     rotationIndex   = 0;
     Position        = position;
     blockType       = type;
     BlockMatrix     = blockType.Rotation(rotationIndex);
     BlockMatrixSize = blockType.BlockDimension();
     BlockRotations  = blockType.BlockRotations();
 }
        public Block SpawnBlock(BlockType type)
        {
            if (!this.CanSpawnBlock())
            {
                throw new InvalidOperationException("can't spawn a new block");
            }

            this.ActiveBlock = new Block(type, new Position {
                Column = (this.columns - type.BlockDimension()) / 2, Row = this.rows - type.BlockDimension() + 1
            });
            this.GameStats.NewSpawn();

            return(this.ActiveBlock);
        }