Exemple #1
0
 public void Attack()
 {
     if (GameInformation.attackMode)
     {
         GameInformation.ResetAttackingPath();
         buttonText.text = "Attack";
     }
     else
     {
         try {
             currentCharacter = GameInformation.currentlySelectedCharacter;
             if (currentCharacter.team1 == GameInformation.player1Turn)
             {
                 if (currentCharacter.attacked == false)
                 {
                     List <HexCoordinates> tempCoords = new List <HexCoordinates>();
                     foreach (HexCoordinates neighbour in currentCharacter.position.CellNeighbours)
                     {
                         tempCoords.Add(neighbour);
                     }
                     if (tempCoords.Count != 0)
                     {
                         CharacterPath attackingPath = new CharacterPath(tempCoords.ToArray(), currentCharacter);
                         GameInformation.currentAttackPath = attackingPath;
                         buttonText.text            = "Cancel";
                         GameInformation.attackMode = true;
                     }
                 }
             }
         } catch {
             GameInformation.attackMode = false;
             buttonText.text            = "Attack";
         }
     }
 }