예제 #1
0
    public virtual IEnumerator PlaySkillSequence(BattleUnitController actor, BattleView battleView, BattleActionResult actionResult)
    {
        Vector3 targetPosition = new Vector3();
        BattleUnitController targetedUnit = null;
        TileController targetedTile = null;

        if (actionResult.targetCharacter != null)
        {
            targetedUnit = battleView.GetBattleUnit(actionResult.targetCharacter);
            targetPosition = targetedUnit.transform.position;
        }
        else
        {
            targetedTile = battleView.GetTileAtMapPosition(actionResult.targetPosition);
            targetPosition = targetedTile.transform.position;
        }

        var actorOrigPosition = actor.transform.position;

        yield return StartCoroutine(actor.MoveToAttackPosition(targetedUnit, targetPosition));

        StartCoroutine(actor.AnimateAttack());

        for (int i = 0; i < actionResult.allSkillEffectResult.Count; ++i)
        {
            var delay = this.GetDelayedKeyFrames(i);
            yield return StartCoroutine(this.WaitForFrames(delay));

            var skillEffectResult = actionResult.allSkillEffectResult[i];

            yield return this.PlayEffects(skillEffectResult.effectsOnTarget, battleView);
        }

        yield return StartCoroutine(actor.ReturnToPosition(actorOrigPosition));

        Destroy(this.gameObject);
    }