コード例 #1
0
 /// <summary>
 /// Move up in the maze command
 /// </summary>
 /// <param name="maze">WinMaze current maze</param>
 public void moveUp(WinMaze maze)
 {
     m_instructions.Clear();
     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;
             m_instructions.Add("display");
             m_instructions.Add("maze");
             ModelChanged();
         }
     }
 }
コード例 #2
0
 /// <summary>
 /// Move forward in the maze command
 /// </summary>
 /// <param name="maze">WinMaze current maze</param>
 public void moveForward(WinMaze maze)
 {
     m_instructions.Clear();
     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;
             m_instructions.Add("display");
             m_instructions.Add("maze");
             ModelChanged();
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// Move down in the maze command
 /// </summary>
 /// <param name="maze">WinMaze current maze</param>
 public void moveDown(WinMaze maze)
 {
     m_instructions.Clear();
     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;
             m_instructions.Add("display");
             m_instructions.Add("maze");
             ModelChanged();
         }
     }
 }
コード例 #4
0
 /// <summary>
 /// Move back in the maze command
 /// </summary>
 /// <param name="maze">WinMaze current maze</param>
 public void moveBack(WinMaze maze)
 {
     m_instructions.Clear();
     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;
             m_instructions.Add("display");
             m_instructions.Add("maze");
             ModelChanged();
         }
     }
 }