示例#1
0
        /// <summary>
        /// Move up in the maze command
        /// </summary>
        public void moveUp()
        {
            WinMaze maze = m_winMazesDictionary["maze"];

            if ((maze.PosZ + 1) < maze.getMaze().MyHeight)
            {
                int isBrockAbove = maze.getMaze().getMazeByFloor(maze.PosZ + 1).getCell(maze.PosX, maze.PosY).BlockOrEmpty;
                if (isBrockAbove == 0)
                {
                    maze.PosZ += 1;
                    m_winMazesDictionary[maze.getName()] = maze;
                    m_currentWinMaze = maze;
                    printMaze(maze, maze.PosZ);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Move forward in the maze command
        /// </summary>
        public void moveForward()
        {
            WinMaze maze = m_winMazesDictionary["maze"];

            int[] currentCellWalls = maze.getMaze().getMazeByFloor(maze.PosZ).getCell(maze.PosX, maze.PosY).getWallsAroundCell();
            if (maze.PosY + 1 < maze.getMaze().MyRows)
            {
                if (currentCellWalls[3] == 0)
                {
                    maze.PosY += 1;
                    m_winMazesDictionary[maze.getName()] = maze;
                    m_currentWinMaze = maze;
                    printMaze(maze, maze.PosZ);
                }
            }
        }
示例#3
0
        /// <summary>
        /// Move down in the maze command
        /// </summary>
        public void moveDown()
        {
            WinMaze maze = m_winMazesDictionary["maze"];

            if (maze.PosZ - 1 >= 0)
            {
                int isBrockBelow = maze.getMaze().getMazeByFloor(maze.PosZ - 1).getCell(maze.PosX, maze.PosY).BlockOrEmpty;
                if (isBrockBelow == 0)
                {
                    maze.PosZ -= 1;
                    m_winMazesDictionary[maze.getName()] = maze;
                    m_currentWinMaze = maze;
                    printMaze(maze, maze.PosZ);
                }
            }
        }
示例#4
0
        /// <summary>
        /// Move back in the maze command
        /// </summary>
        public void moveBack()
        {
            WinMaze maze = m_winMazesDictionary["maze"];

            int[] currentCellWalls = maze.getMaze().getMazeByFloor(maze.PosZ).getCell(maze.PosX, maze.PosY).getWallsAroundCell();
            if (maze.PosY - 1 >= 0)
            {
                int[] currentCellWallsBack = maze.getMaze().getMazeByFloor(maze.PosZ).getCell(maze.PosX, maze.PosY - 1).getWallsAroundCell();
                if ((currentCellWalls[2] == 0) || (currentCellWallsBack[3] == 0))
                {
                    maze.PosY -= 1;
                    m_winMazesDictionary[maze.getName()] = maze;
                    m_currentWinMaze = maze;
                    printMaze(maze, maze.PosZ);
                }
            }
        }