Exemplo n.º 1
0
 //allows for turn based attack system. Will deal any effect damage the battler has
 public override void SwitchAttacker()
 {
     attackerIndex++;
     if (attackerIndex > Battlers.Count - 1)
     {
         attackerIndex = 0;
         ui.ChangeButtonVisibility(true);
     }
     Attacker = Battlers [attackerIndex];
     Attacker.IsBlockingState = new AttackableState(ui, this, Attacker);
     if (Attacker.HasEffectDamage)
     {
         Attacker.HP -= Attacker.EffectDamage;
         Attacker.IsAbleToHealState = new CanHealState(ui, this, Attacker);
         StartCoroutine(ui.UpdateHPLabels(Attacker.Name, Battlers.IndexOf(Attacker), Attacker.HP, true, 0));
         StartCoroutine(CheckIfDefeated(Attacker, false));
     }
     if (Attacker.GetType().Name == "Enemy")
     {
         ui.ChangeButtonVisibility(false);
         EnemyAttacks();
     }
     ui.SetButtonListeners(Battlers [attackerIndex]);
     currentPlayer.text = Attacker.Name + "'s turn";
 }
Exemplo n.º 2
0
 //checks to see if both enemies were defeated and will load the next scene if true
 public override void Update()
 {
     if (!Battlers.Contains(enemy1) && !Battlers.Contains(enemy2))
     {
         ui.OnBattleEndDialogue(true);
         ui.ChangeButtonVisibility(false);
     }
     if (!Battlers.Contains(playerChar))
     {
         ui.ChangeButtonVisibility(false);
         ui.OnBattleEndDialogue(false);
     }
 }
Exemplo n.º 3
0
 //After an attack, coroutines will start to allow the player to see what move was used and how much damage it did (and check if the defender was defeated)
 public override void UpdateUIPostAttack(double damage)
 {
     StartCoroutine(ui.UpdateDamageDealt(Attacker.Name, SelectedAction, Defender.Name, damage, Battlers.IndexOf(Defender)));
     StartCoroutine(ui.UpdateHPLabels(Defender.Name, Battlers.IndexOf(Defender), Defender.HP, Defender.HasEffectDamage, 1));
     StartCoroutine(CheckIfDefeated(Defender, true));
 }