//効果の処理 private IEnumerator EffctExecution(BattleCommand battleCommand) { BattleCharacter owner = battleCommand.owner; List <BattleCharacter> targets = battleCommand.target; TargetUnit targetUnit = battleCommand.GetTargetType().targetUnit; PlayableAsset playableAsset = battleCommand.GetCommand().animation; var effects = battleCommand.GetEffect(); //効果の範囲が全体の場合 if (battleCommand.GetTargetType().targetRange == TargetRange.全体) { //敵キャラクタの行動はアニメション表示をしない if (owner is PlayerCharacter) { BattleDirectorController.Instance.AnimationPlay(playableAsset); } } foreach (var effect in effects) { //単体処理 foreach (var target in targets) { //ターゲットが存在しないとき新しいターゲットに変更する BattleCharacter newTarget = target; if (TargetUnit.死亡者 != targetUnit && target.IsDead()) { TargetFilter targetFilter = new TargetFilter(); newTarget = targetFilter.Auto(battleCommand); } //効果の処理 if (battleCommand.GetTargetType().targetRange == TargetRange.単体) { //敵キャラクタの行動はアニメション表示をしない if (owner is PlayerCharacter) { BattleDirectorController.Instance.AnimationPlay(playableAsset, newTarget.transform); } } effect.Use(owner, newTarget); //演出を再生する yield return(BattleDirectorController.Instance.Play()); } } yield break; }
//バトルコマンドの効果を実行します public IEnumerator Execution(BattleCommand battleCommand) { BattleCharacter owner = battleCommand.owner; List <BattleCharacter> targets = battleCommand.target; TargetUnit targetUnit = battleCommand.GetTargetType().targetUnit; var effects = battleCommand.GetEffect(); foreach (var effect in effects) { foreach (var target in targets) { if (!CanEffect(target, targetUnit)) { continue; } yield return(StartCoroutine(EffectExecution(effect, owner, target))); } } yield break; }