public IEnumerator PlayEffects(List<BattleActionResult.EffectOnTarget> effectsOnTarget, BattleView battleView) { for (int i = 0; i < effectsOnTarget.Count; ++i) { var effectOnTarget = effectsOnTarget[i]; if (effectOnTarget.isEmptyEffect) { continue; } var unit = battleView.GetBattleUnit(effectOnTarget.target); if (i != effectsOnTarget.Count - 1) { StartCoroutine(PlayEffectOnTarget(unit, effectOnTarget)); } else { yield return StartCoroutine(PlayEffectOnTarget(unit, effectOnTarget)); } } }
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); }