예제 #1
0
    IEnumerator RunMove(PlayerBattleUnit sourceUnit, PlayerBattleUnit targetUnit, MoveBehaviour move)
    {
        move.UsageMove--;
        yield return(dialogBox.TypeDialog($"{sourceUnit.servantInfo.servantBase.Name} used {move.Base.Name}"));

        sourceUnit.PlayAttackAnimation();
        yield return(new WaitForSeconds(1f));

        targetUnit.PlayHitAnimation();

        var damageDetails = targetUnit.servantInfo.TakeDamage(move, sourceUnit.servantInfo);

        yield return(targetUnit.Hud.UpdateHP());

        yield return(ShowDamageDetails(damageDetails));

        if (damageDetails.Fainted)
        {
            yield return(dialogBox.TypeDialog($"{targetUnit.servantInfo.servantBase.Name} Fainted"));

            targetUnit.PlayFaintAnimation();
            yield return(new WaitForSeconds(2f));

            CheckForBattleOver(targetUnit);
        }
    }
예제 #2
0
 void CheckForBattleOver(PlayerBattleUnit faintedUnit)
 {
     if (faintedUnit.IsPlayerUnit)
     {
         var nextServant = servantParty.GetHealthyServant();
         if (nextServant != null)
         {
             OpenPartyScreen();
         }
         else
         {
             BattleOver(false);
         }
     }
     else
     {
         BattleOver(true);
     }
 }