diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 0707dc6..0cdc46e 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -6,34 +6,56 @@ public class GameManager : MonoBehaviour, Subject { // 1. Singleton Pattern: Instance() method private static GameManager _instance; + public static GameManager Instance() + { + return _instance; + } + - // �ʱ�ȭ ���� �ٲ��� �� �� + // 초기화 설정 바꾸지 말 것 private int _gameRound = 0; private string _whoseTurn = "Enemy"; private bool _isEnd = false; - // delegate: TurnHandler, FinishHandler ���� + // delegate: TurnHandler, FinishHandler 선언 + delegate void TurnUpdate(int round, string turn); + TurnUpdate _turnHandler; + + delegate void FinishUpdate(bool isFinish); + FinishUpdate _finishHandler; /// /// 2. RoundNotify: - /// 1) ���� ���� Enemy�̸� ���� gameRound�� + /// 1) 현재 턴이 Enemy이면 다음 gameRound로 /// + Debug.Log($"GameManager: Round {gameRound}."); - /// 2) TurnNotify() ȣ�� + /// 2) TurnNotify() 호출 /// public void RoundNotify() { - + _whoseTurn = "Enemy"; + if(_whoseTurn == "Enemy") + { + _gameRound = _gameRound + 1; + Debug.Log($"GameManager: Round {_gameRound}."); + TurnNotify(); + } + } /// /// 3. TurnNotify: /// 1) whoseTurn update /// + Debug.Log($"GameManager: {_whoseTurn} turn."); - /// 2) _turnHandler ȣ�� + /// 2) _turnHandler 호출 /// public void TurnNotify() { - + _whoseTurn= "Player"; + + Debug.Log($"GameManager: {_whoseTurn} turn."); + + RoundNotify(); + //_turnHandler(_gameRound, _whoseTurn); } /// @@ -41,14 +63,17 @@ public void TurnNotify() /// 1) isEnd update /// + Debug.Log("GameManager: The End"); /// + Debug.Log($"GameManager: {_whoseTurn} is Win!"); - /// 2) _finishHandler ȣ�� + /// 2) _finishHandler 호출 /// public void EndNotify() { - + _isEnd = true; + Debug.Log("GameManager: The End"); + Debug.Log($"GameManager: {_whoseTurn} is Win!"); + _finishHandler(_isEnd); } - // 5. AddCharacter: _turnHandler, _finishHandler ������ �޼ҵ� �߰� + // 5. AddCharacter: _turnHandler, _finishHandler ������ �޼ҵ� �߰� public void AddCharacter(Character character) {