Beispiel #1
0
 private void ShowPath(int speed)
 {
     if (currentPathExists)
     {
         HexCell current = currentPathTo;
         while (current != currentPathFrom)
         {
             int turn = (current.Distance - 1) / speed;
             current.SetLabel(turn.ToString());
             current.EnableHighlight(Color.white);
             current = current.PathFrom;
         }
     }
     currentPathFrom.EnableHighlight(Color.blue);
     currentPathTo.EnableHighlight(Color.red);
 }
Beispiel #2
0
 public void ClearPath()
 {
     if (currentPathExists)
     {
         HexCell current = currentPathTo;
         while (current != currentPathFrom)
         {
             current.SetLabel(null);
             current.DisableHighlight();
             current = current.PathFrom;
         }
         current.DisableHighlight();
         currentPathExists = false;
     }
     else if (currentPathFrom)
     {
         currentPathFrom.DisableHighlight();
         currentPathTo.DisableHighlight();
     }
     currentPathFrom = currentPathTo = null;
 }