DO-33 [Feat] Timer 연동
This commit is contained in:
parent
29cbe683ac
commit
b43fb6a726
@ -6147,6 +6147,11 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 9726acf6f82a3644ba31eda5ef496991, type: 3}
|
m_Script: {fileID: 11500000, guid: 9726acf6f82a3644ba31eda5ef496991, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!224 &832166178 stripped
|
||||||
|
RectTransform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 1468824283}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
--- !u!1001 &846962871
|
--- !u!1001 &846962871
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -10812,6 +10817,111 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 9726acf6f82a3644ba31eda5ef496991, type: 3}
|
m_Script: {fileID: 11500000, guid: 9726acf6f82a3644ba31eda5ef496991, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!1001 &1468824283
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 4044003808638558126}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 4527645627922892802, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Retry Button
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5432505654977179684, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 679766977}
|
||||||
|
- target: {fileID: 5432505654977179684, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
|
||||||
|
value: RetryGame
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_Pivot.x
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_Pivot.y
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.x
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.x
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 228
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 125.899994
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: -50
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: -100
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6675599954136940932, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 67fa853934a50654381442493bf1bb7b, type: 3}
|
||||||
--- !u!1001 &1469317351
|
--- !u!1001 &1469317351
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -18359,6 +18469,7 @@ RectTransform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 4020956125928089309}
|
- {fileID: 4020956125928089309}
|
||||||
- {fileID: 5290633646021932}
|
- {fileID: 5290633646021932}
|
||||||
|
- {fileID: 832166178}
|
||||||
m_Father: {fileID: 6113787613455091453}
|
m_Father: {fileID: 6113787613455091453}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
|
@ -12,6 +12,9 @@ public abstract class BasePlayerState
|
|||||||
|
|
||||||
public void ProcessMove(GameLogic gameLogic, Enums.PlayerType playerType, int row, int col)
|
public void ProcessMove(GameLogic gameLogic, Enums.PlayerType playerType, int row, int col)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
gameLogic.fioTimer.PauseTimer();
|
||||||
|
|
||||||
gameLogic.SetNewBoardValue(playerType, row, col);
|
gameLogic.SetNewBoardValue(playerType, row, col);
|
||||||
//TODO: 승리확인
|
//TODO: 승리확인
|
||||||
if (gameLogic.CheckGameWin(playerType, row, col))
|
if (gameLogic.CheckGameWin(playerType, row, col))
|
||||||
@ -39,6 +42,8 @@ public class PlayerState : BasePlayerState
|
|||||||
|
|
||||||
public override void OnEnter(GameLogic gameLogic)
|
public override void OnEnter(GameLogic gameLogic)
|
||||||
{
|
{
|
||||||
|
gameLogic.fioTimer.StartTimer();
|
||||||
|
|
||||||
gameLogic.currentTurn = _playerType;
|
gameLogic.currentTurn = _playerType;
|
||||||
gameLogic.stoneController.OnStoneClickedDelegate = (row, col) =>
|
gameLogic.stoneController.OnStoneClickedDelegate = (row, col) =>
|
||||||
{
|
{
|
||||||
@ -48,6 +53,7 @@ public class PlayerState : BasePlayerState
|
|||||||
|
|
||||||
public override void OnExit(GameLogic gameLogic)
|
public override void OnExit(GameLogic gameLogic)
|
||||||
{
|
{
|
||||||
|
gameLogic.fioTimer.InitTimer();
|
||||||
gameLogic.stoneController.OnStoneClickedDelegate = null;
|
gameLogic.stoneController.OnStoneClickedDelegate = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,12 +79,13 @@ public class AIState: BasePlayerState
|
|||||||
{
|
{
|
||||||
public override void OnEnter(GameLogic gameLogic)
|
public override void OnEnter(GameLogic gameLogic)
|
||||||
{
|
{
|
||||||
|
gameLogic.fioTimer.StartTimer();
|
||||||
//TODO: AI이식
|
//TODO: AI이식
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnExit(GameLogic gameLogic)
|
public override void OnExit(GameLogic gameLogic)
|
||||||
{
|
{
|
||||||
|
gameLogic.fioTimer.InitTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void HandleMove(GameLogic gameLogic, int row, int col)
|
public override void HandleMove(GameLogic gameLogic, int row, int col)
|
||||||
@ -95,12 +102,12 @@ public class MultiPlayerState: BasePlayerState
|
|||||||
{
|
{
|
||||||
public override void OnEnter(GameLogic gameLogic)
|
public override void OnEnter(GameLogic gameLogic)
|
||||||
{
|
{
|
||||||
|
gameLogic.fioTimer.StartTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnExit(GameLogic gameLogic)
|
public override void OnExit(GameLogic gameLogic)
|
||||||
{
|
{
|
||||||
|
gameLogic.fioTimer.InitTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void HandleMove(GameLogic gameLogic, int row, int col)
|
public override void HandleMove(GameLogic gameLogic, int row, int col)
|
||||||
@ -123,6 +130,7 @@ public class GameLogic : MonoBehaviour
|
|||||||
public BasePlayerState firstPlayerState;
|
public BasePlayerState firstPlayerState;
|
||||||
public BasePlayerState secondPlayerState;
|
public BasePlayerState secondPlayerState;
|
||||||
private BasePlayerState _currentPlayerState;
|
private BasePlayerState _currentPlayerState;
|
||||||
|
public FioTimer fioTimer;
|
||||||
|
|
||||||
private const int WIN_COUNT = 5;
|
private const int WIN_COUNT = 5;
|
||||||
//선택된 좌표
|
//선택된 좌표
|
||||||
@ -140,16 +148,34 @@ public class GameLogic : MonoBehaviour
|
|||||||
new int[] {1, -1} // 대각선 ↙ ↗
|
new int[] {1, -1} // 대각선 ↙ ↗
|
||||||
};
|
};
|
||||||
|
|
||||||
public GameLogic(StoneController stoneController, Enums.GameType gameType)
|
public GameLogic(StoneController stoneController, Enums.GameType gameType, FioTimer fioTimer)
|
||||||
{
|
{
|
||||||
//보드 초기화
|
//보드 초기화
|
||||||
_board = new Enums.PlayerType[15, 15];
|
_board = new Enums.PlayerType[15, 15];
|
||||||
this.stoneController = stoneController;
|
this.stoneController = stoneController;
|
||||||
this.gameType = gameType;
|
this.gameType = gameType;
|
||||||
|
|
||||||
selectedRow = -1;
|
selectedRow = -1;
|
||||||
selectedCol = -1;
|
selectedCol = -1;
|
||||||
_lastRow = -1;
|
_lastRow = -1;
|
||||||
_lastCol = -1;
|
_lastCol = -1;
|
||||||
|
//timer 초기화
|
||||||
|
this.fioTimer = fioTimer;
|
||||||
|
this.fioTimer.InitTimer();
|
||||||
|
//timer 시간초과시 진행 함수
|
||||||
|
this.fioTimer.OnTimeout = () =>
|
||||||
|
{
|
||||||
|
if (currentTurn == Enums.PlayerType.PlayerA)
|
||||||
|
{
|
||||||
|
GameManager.Instance.OpenConfirmPanel($"Game Over: {PlayerType.PlayerB} Win",() =>{});
|
||||||
|
EndGame();
|
||||||
|
}
|
||||||
|
else if (currentTurn == Enums.PlayerType.PlayerB)
|
||||||
|
{
|
||||||
|
GameManager.Instance.OpenConfirmPanel($"Game Over: {PlayerType.PlayerA} Win",() =>{});
|
||||||
|
EndGame();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
switch (gameType)
|
switch (gameType)
|
||||||
{
|
{
|
||||||
|
@ -19,6 +19,7 @@ public class GameManager : Singleton<GameManager>
|
|||||||
private UserManager _userManager; // UserManager 인스턴스 관리
|
private UserManager _userManager; // UserManager 인스턴스 관리
|
||||||
private CoinsPanelController _coinsPanel;
|
private CoinsPanelController _coinsPanel;
|
||||||
|
|
||||||
|
|
||||||
private Enums.GameType _gameType;
|
private Enums.GameType _gameType;
|
||||||
private GameLogic _gameLogic;
|
private GameLogic _gameLogic;
|
||||||
private StoneController _stoneController;
|
private StoneController _stoneController;
|
||||||
@ -49,7 +50,8 @@ public class GameManager : Singleton<GameManager>
|
|||||||
_canvas = canvas.GetComponent<Canvas>();
|
_canvas = canvas.GetComponent<Canvas>();
|
||||||
_stoneController = GameObject.FindObjectOfType<StoneController>();
|
_stoneController = GameObject.FindObjectOfType<StoneController>();
|
||||||
_stoneController.InitStones();
|
_stoneController.InitStones();
|
||||||
_gameLogic = new GameLogic(_stoneController, _gameType);
|
var fioTimer = FindObjectOfType<FioTimer>();
|
||||||
|
_gameLogic = new GameLogic(_stoneController, _gameType, fioTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TryAutoSignin()
|
private void TryAutoSignin()
|
||||||
@ -142,7 +144,8 @@ public class GameManager : Singleton<GameManager>
|
|||||||
{
|
{
|
||||||
_stoneController = GameObject.FindObjectOfType<StoneController>();
|
_stoneController = GameObject.FindObjectOfType<StoneController>();
|
||||||
_stoneController.InitStones();
|
_stoneController.InitStones();
|
||||||
_gameLogic = new GameLogic(_stoneController, _gameType);
|
var fioTimer = FindObjectOfType<FioTimer>();
|
||||||
|
_gameLogic = new GameLogic(_stoneController, _gameType, fioTimer);
|
||||||
}
|
}
|
||||||
_canvas = GameObject.Find("Canvas").GetComponent<Canvas>();
|
_canvas = GameObject.Find("Canvas").GetComponent<Canvas>();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user