-
-
Save todorok1/9b52432c352fd902ff09ed5e6073fdc1 to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第40回 戦闘に関する機能を管理するクラス
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
| using UnityEngine; | |
| namespace SimpleRpg | |
| { | |
| /// <summary> | |
| /// 戦闘に関する機能を管理するクラスです。 | |
| /// </summary> | |
| public class BattleManager : MonoBehaviour | |
| { | |
| /// <summary> | |
| /// 戦闘開始の処理を行うクラスへの参照です。 | |
| /// </summary> | |
| [SerializeField] | |
| BattleStarter _battleStarter; | |
| /// <summary> | |
| /// 戦闘関連のスプライトを制御するクラスへの参照です。 | |
| /// </summary> | |
| [SerializeField] | |
| BattleSpriteController _battleSpriteController; | |
| /// <summary> | |
| /// 戦闘のフェーズです。 | |
| /// </summary> | |
| public BattlePhase BattlePhase { get; private set; } | |
| /// <summary> | |
| /// 選択されたコマンドです。 | |
| /// </summary> | |
| public BattleCommand SelectedCommand { get; private set; } | |
| /// <summary> | |
| /// エンカウントした敵キャラクターのIDです。 | |
| /// </summary> | |
| public int EnemyId { get; private set; } | |
| /// <summary> | |
| /// 戦闘開始からのターン数です。 | |
| /// </summary> | |
| public int TurnCount { get; private set; } | |
| /// <summary> | |
| /// 戦闘のフェーズを変更します。 | |
| /// </summary> | |
| /// <param name="battlePhase">変更後のフェーズ</param> | |
| public void SetBattlePhase(BattlePhase battlePhase) | |
| { | |
| BattlePhase = battlePhase; | |
| } | |
| /// <summary> | |
| /// 敵キャラクターのステータスをセットします。 | |
| /// </summary> | |
| /// <param name="enemyId">敵キャラクターのID</param> | |
| public void SetUpEnemyStatus(int enemyId) | |
| { | |
| EnemyId = enemyId; | |
| } | |
| /// <summary> | |
| /// 戦闘の開始処理を行います。 | |
| /// </summary> | |
| public void StartBattle() | |
| { | |
| SimpleLogger.Instance.Log("戦闘を開始します。"); | |
| GameStateManager.ChangeToBattle(); | |
| SetBattlePhase(BattlePhase.ShowEnemy); | |
| _battleStarter.StartBattle(this); | |
| } | |
| /// <summary> | |
| /// 戦闘関連のスプライトを制御するクラスへの参照を取得します。 | |
| /// </summary> | |
| public BattleSpriteController GetBattleSpriteController() | |
| { | |
| return _battleSpriteController; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment