Example #1
0
 // Evento de clique no btnSpecial. Verifica qual player que tá selecionado e desencadeia seu special.
 public void OnClickSpecial()
 {
     foreach (PlayerBehaviour player in players)
     {
         if (player.State == PlayerBehaviour.STATE.SELECTED)
         {
             if (player is ArcherBehaviour)                                  // Se é o special do archer
             {
                 ArcherBehaviour archerBehaviour = (ArcherBehaviour)player;
                 // We need to make a copy of the list and pass it as reference,
                 // or else when the clear function is called the original list is cleared
                 GameObject[] array = new GameObject[GameManager.enemies.Count];
                 GameManager.enemies.CopyTo(array);
                 archerBehaviour.SpecialCommand(new List <GameObject>(array));
             }
             else if (player is WarriorBehaviour)
             {
                 WarriorBehaviour warriorBehaviour = (WarriorBehaviour)player;
                 warriorBehaviour.SpecialCommand(new List <GameObject>());
                 // Mage only enables selecting target
             }
             else
             {
                 player.State = PlayerBehaviour.STATE.SPECIAL;
             }
             battleUI.SetActive(false);
             return;
         }
     }
 }
Example #2
0
    // Evento de clique no btnSpecial. Verifica qual player que tá selecionado e desencadeia seu special.
    public void OnClickSpecial()
    {
        int             i;
        PlayerBehaviour playerBehaviour;

        foreach (GameObject player in players)
        {
            playerBehaviour = player.GetComponent <PlayerBehaviour> ();
            if (playerBehaviour.State == PlayerBehaviour.STATE.SELECTED)
            {
                if (playerBehaviour is ArcherBehaviour)                                 // Se é o special do archer
                {
                    ArcherBehaviour archerBehaviour = (ArcherBehaviour)playerBehaviour;
                    archerBehaviour.SpecialCommand(enemies);
                }
                else
                {
                    playerBehaviour.State = PlayerBehaviour.STATE.SPECIAL;
                }
                battleUI.SetActive(false);
                return;
            }
        }
    }