-
-
Save todorok1/e98a91051d53f9cc7ed4b996740ba949 to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第39回 戦闘に関する機能を管理するクラス
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> | |
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); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment