示例#1
0
    public override IEnumerator ExecuteAction(FightingEntity user, List <FightingEntity> targets, BattleFight battleFight)
    {
        _battleFight = battleFight;
        FightResult result = new FightResult(user, this);

        if (CheckCost(user))
        {
            PayCost(user);
            ActionBase selectedAction = _actions[Random.Range(0, _actions.Length)];
            targets = selectedAction.GetNewTargets(user);

            // Play animation
            yield return(GameManager.Instance.time.GetController().StartCoroutine(selectedAction.PlayAnimation(user, targets)));

            result = selectedAction.ApplyEffect(user, targets);
            OnPostEffect(result);
            _battleFight.EndFight(result, this);
            yield return(GameManager.Instance.time.GetController().WaitForSeconds(selectedAction.animation.GetAnimCooldown()));
        }
    }