Ejemplo n.º 1
0
        private int GetCorrectRotation(BlocksType blockType, int rotation)
        {
            switch (blockType)
            {
            case BlocksType.Cleveland_Z:
            case BlocksType.Rhode_Island_Z:
            case BlocksType.Hero:
                return(rotation % 2);

            case BlocksType.Smashboy:
                return(0);
            }
            return(rotation);
        }
Ejemplo n.º 2
0
        private void SetSingleBlockElements(BlocksType blockType, int rotation, int row, int col)
        {
            rotation = GetCorrectRotation(blockType, rotation);
            var intMatrix = Config.BlocksToDictMatrix[blockType][rotation];
            var lenY      = intMatrix.GetLength(0);
            var lenX      = intMatrix.GetLength(1);

            for (var y = lenY; y > 0; y--)
            {
                var dy = y - lenY;
                for (var x = -1; x < lenX - 1; x++)
                {
                    if (row + dy >= 0 && row + dy < Config.MAP_SIZE.Item2 && col + x >= 0 && col + x < Config.MAP_SIZE.Item1)
                    {
                        Single_block[row + dy, col + x] = intMatrix[y - 1, x + 1];
                    }
                }
            }
        }