Example #1
0
 public void moveDown()
 {
     if (!labyrinth.cells[X, Y].bottom)
     {
         try
         {
             Y += 1;
             labyrinth.cells[X, Y].visited = true;
             drawSpot();
             steps++;
             if (PlayerWon != null && labyrinth.cells[X, Y] == labyrinth.finishCell)
             {
                 WinEventArgs e = new WinEventArgs(steps);
                 PlayerWon(this, e);
             }
         }
         catch (System.IndexOutOfRangeException) {; }
     }
 }
Example #2
0
 private void OnPlayerWon(Object sender, WinEventArgs e)
 {
     Console.WriteLine($"You won in {e.steps} steps");
     drawCenteredText(labGrid, new Canvas(), $"You won in {e.steps} steps");
 }