Esempio n. 1
0
 bool CanContinueBattle()
 {
     // verify if there are units in both parties that can fight
     if (playerPartyPanel.CanFight() && enemyPartyPanel.CanFight())
     {
         // can continue battle
         return(true);
     }
     // cannot continue battle
     return(false);
 }
Esempio n. 2
0
 IEnumerator EndBattle()
 {
     Debug.Log("EndBattle");
     // set battle has ended
     BattleHasEnded = true;
     battleHasEnded.Raise();
     // Remove highlight from active unit
     ActiveUnitUI.HighlightActiveUnitInBattle(false);
     //// Set exit button variable
     //BattleExit exitButton = GetBattleExitButton();
     //// Activate exit battle button;
     //exitButton.gameObject.SetActive(true);
     // Deactivate all other battle buttons;
     // SetBattleControlsActive(false);
     // Check who win battle
     if (!playerPartyPanel.CanFight())
     {
         Debug.Log("Player cannot fight anymore");
         // player cannot fight anymore
         // verify if player has flee from battle
         if (playerPartyPanel.HasEscapedBattle())
         {
             Debug.Log("Player has escaped battle");
             // On exit: move it 2 tiles away from other party
             exitOption = ExitOption.FleePlayer;
         }
         else
         {
             Debug.Log("Player lost battle and was destroyed");
             // verify if battle was with city Garnizon:
             // .. this is not needed here because city garnizon cannot initiate fight
             // On exit: destroy player party
             exitOption = ExitOption.DestroyPlayer;
         }
         // Show how much experience was earned by enemy party
         enemyPartyPanel.GrantAndShowExperienceGained(playerPartyPanel);
     }
     else
     {
         Debug.Log("Enemy cannot fight anymore");
         // verify if enemy has flee from battle
         if (enemyPartyPanel.HasEscapedBattle())
         {
             Debug.Log("Enemy has escaped battle");
             // On exit: move it 2 tiles away from other party
             exitOption = ExitOption.FleeEnemy;
         }
         else
         {
             Debug.Log("Enemy lost battle and was destroyed");
             // verify if battle was with city Garnizon:
             if (enemyPartyPanel.GetHeroParty().PartyMode == PartyMode.Garnizon)
             {
                 // On exit: enter city
                 Debug.Log("Enter city on exit");
                 exitOption = ExitOption.EnterCity;
             }
             else if (enemyPartyPanel.GetHeroParty().PartyMode == PartyMode.Party)
             {
                 // On exit: destroy enemy party
                 exitOption = ExitOption.DestroyEnemy;
             }
             else
             {
                 Debug.LogError("Unknown party mode " + enemyPartyPanel.GetHeroParty().PartyMode.ToString());
             }
         }
         // Show how much experience was earned by player party
         playerPartyPanel.GrantAndShowExperienceGained(enemyPartyPanel);
     }
     // Remove all buffs and debuffs
     enemyPartyPanel.RemoveAllBuffsAndDebuffs();
     playerPartyPanel.RemoveAllBuffsAndDebuffs();
     // unblock input
     InputBlocker.SetActive(false);
     yield return(null);
 }