Beispiel #1
0
    private IEnumerator BattleWon()
    {
        ClearEnemyParty();

        GameObject stack = ObjectPooler.Instance.SpawnFromPool(coinStack.tag, playerParty.transform, coinOrigin, Quaternion.identity);

        stack.transform.DOScale(Vector3.one, 0);

        Tween coinFall = stack.transform.DOLocalMoveY(0, coinFallTime).SetEase(Ease.OutBounce);

        yield return(coinFall.WaitForCompletion());

        yield return(new WaitForSecondsRealtime(waitBetweenActions));

        Transform currentLeader = null;

        for (int i = 0; i < playerParty.characters.Count; i++)
        {
            if (playerParty.characters[i].IsDead == false)
            {
                currentLeader = playerParty.characters[i].transform;
                break;
            }
        }

        Tween coinToLeader = stack.transform.DOLocalJump(currentLeader.localPosition, jumpStrength, 1, coinToPartyTime).SetEase(coinToPartyEase);
        Tween coinScale    = stack.transform.DOScale(Vector3.zero, coinToPartyTime).SetEase(coinToPartyEase);

        yield return(coinToLeader.WaitForCompletion());

        int coins      = enemySpawner.GetCoins();
        int experience = enemySpawner.GetExperience();

        infoBox.GainGoldText(coins);
        yield return(new WaitForSecondsRealtime(waitBetweenText));

        infoBox.GainExperienceText(experience);
        yield return(new WaitForSecondsRealtime(waitBetweenText));

        RecoverAfterBattle();
        infoBox.RecoverdSomeHP();
        yield return(new WaitForSecondsRealtime(waitBetweenText));

        ShowHideLines(false);
        healthMenu.PlayTweenReversed();
        Game.Instance.SetWalking();
    }