-
-
Save todorok1/fa55d0bae7b72b91112ea6a21d97a916 to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第58回 戦闘中のアクションを処理するクラス
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// アクションリストの内容を優先度に応じて処理していきます。 | |
| /// </summary> | |
| IEnumerator ProcessAction() | |
| { | |
| var query = _actions.OrderByDescending(a => a.priority).ToList(); | |
| foreach (var action in query) | |
| { | |
| SimpleLogger.Instance.Log($"キャラクターの行動を開始します。action.priority : {action.priority}"); | |
| if (_battleManager.IsBattleFinished) | |
| { | |
| SimpleLogger.Instance.Log("戦闘が終了しているため、処理を中断します。"); | |
| yield break; | |
| } | |
| SimpleLogger.Instance.Log($"コマンドに応じた行動を行います。 コマンド : {action.battleCommand}"); | |
| switch (action.battleCommand) | |
| { | |
| case BattleCommand.Attack: | |
| _battleActionProcessorAttack.ProcessAction(action); | |
| break; | |
| case BattleCommand.Magic: | |
| _battleActionProcessorMagic.ProcessAction(action); | |
| break; | |
| case BattleCommand.Item: | |
| _battleActionProcessorItem.ProcessAction(action); | |
| break; | |
| case BattleCommand.Run: | |
| _battleActionProcessorRun.ProcessAction(action); | |
| break; | |
| } | |
| while (IsPausedProcess) | |
| { | |
| yield return null; | |
| } | |
| yield return new WaitForSeconds(_actionInterval); | |
| } | |
| // ターン内の行動が完了したことを通知します。 | |
| _battleManager.OnFinishedActions(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment