public void Initialize()
        {
            Single currentPosX = posX;
            Single currentPosY = posY;
            List<ITile> temp;
            ITile ATile;

            //Fixed objects
            temp = new List<ITile>();
            tiles.Add(temp);
            ATile = new DrawDot(currentPosX, currentPosY, width, height);
            tiles[0].Add(ATile);
            currentPosX += width;
            for (int i = 0; i < 3; i++)
            {
                ATile = new DrawHWall(currentPosX, currentPosY, width, height);
                tiles[0].Add(ATile);
                currentPosX += width;
            }
            currentPosX = posX;
            currentPosY += height;

            temp = new List<ITile>();
            tiles.Add(temp);
            ATile = new DrawVWall(currentPosX, currentPosY, width, height * 3);
            tiles[1].Add(ATile);
            currentPosX += width;
            for (int i = 0; i < 3; i++)
            {
                ATile = new DrawSpace(currentPosX, currentPosY, width, height * 3);
                tiles[1].Add(ATile);
                currentPosX += width;
            }
        }
コード例 #2
0
        private ITile CreateTypeOfObject(String input, Single posX, Single posY, Boolean isLongSpace)
        {

            ITile tile;
            Single smallerTileWidth = tileWidth / 4;

            switch (input)
            {
                case ".":
                    tile = new DrawDot(posX, posY, smallerTileWidth, smallerTileWidth);
                    break;
                case "_":
                    tile = new DrawHWall(posX, posY, smallerTileWidth, smallerTileWidth);
                    break;
                case " ":
                    if (isLongSpace == true)
                    {
                        tile = new DrawSpace(posX, posY, smallerTileWidth, smallerTileWidth * 3);
                    }
                    else
                    {
                        tile = new DrawSpace(posX, posY, smallerTileWidth, smallerTileWidth);
                    }
                    break;
                case "|":
                    tile = new DrawVWall(posX, posY, smallerTileWidth, smallerTileWidth * 3);
                    break;
                case "X":
                    tile = new DrawExit(posX - smallerTileWidth, posY, smallerTileWidth * 3, smallerTileWidth * 3);
                    hasExit = true;
                    break;
                case "T":
                    tile = new DrawTheseus(posX - smallerTileWidth, posY, smallerTileWidth * 3, smallerTileWidth * 3);
                    hasTheseus = true;
                    break;
                case "M":
                    tile = new DrawMinotaur(posX - smallerTileWidth, posY, smallerTileWidth * 3, smallerTileWidth * 3);
                    hasMinotaur = true;
                    break;
                default:
                    tile = new DrawDot(posX, posY, smallerTileWidth, smallerTileWidth);
                    break;
            }
            return tile;
        }