Compare commits
2 Commits
84c48d4adc
...
06821c0030
| Author | SHA1 | Date | |
|---|---|---|---|
| 06821c0030 | |||
| ae15daed75 |
@ -8460,9 +8460,11 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 0483b263e22fc433caab31141efbe319, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
isDebugTest: 0
|
||||
isDebugAITest: 0
|
||||
isDebugPlayerTest: 0
|
||||
diceRollHandler: {fileID: 1013177415}
|
||||
diceValue: 0
|
||||
botDiceRollDelay: 0.25
|
||||
maxDiceSixRollCounter: 2
|
||||
totalStepsForCharacter: 57
|
||||
diceText: {fileID: 953941044}
|
||||
@ -11557,7 +11559,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
diceView: {fileID: 1619592888}
|
||||
diceTestValue: 1
|
||||
diceTestValue: 0
|
||||
--- !u!4 &1039618837 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 5672526856521419272, guid: 4dc45edb05c8f4268aebcd5e9cbac783, type: 3}
|
||||
@ -15159,6 +15161,7 @@ MonoBehaviour:
|
||||
- {fileID: 1107252688}
|
||||
- {fileID: 1406544794}
|
||||
- {fileID: 884011400}
|
||||
enableLogs: 0
|
||||
--- !u!4 &1335794571
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -27893,7 +27896,7 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 457192420, guid: c657b4c04be754166a725c1b25fbea7d, type: 3}
|
||||
m_Sprite: {fileID: 652690593, guid: 1467c87c1b60f4707b78abdf2804ec02, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 1
|
||||
m_FillCenter: 1
|
||||
|
||||
@ -24,7 +24,11 @@ public class BotModeData
|
||||
|
||||
public class GameModeHandler : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
{
|
||||
private GameplayManager gameplayManager;
|
||||
public GameplayManager GameplayManager
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
private PVPModeData pvpModeData;
|
||||
private BotModeData botModeData;
|
||||
|
||||
@ -46,7 +50,7 @@ public class GameModeHandler : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
public void InitializeData()
|
||||
{
|
||||
GameManager = InterfaceManager.Instance.GetInterfaceInstance<GameManager>();
|
||||
gameplayManager = InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
||||
GameplayManager = InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
||||
}
|
||||
|
||||
public void InitPVPModeData(List<PlayerType> types, List<string> names)
|
||||
@ -57,7 +61,7 @@ public class GameModeHandler : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
};
|
||||
|
||||
CurrentGameModeType = GameModeType.PVP;
|
||||
gameplayManager.InitPlayerTypesForPVP(types, names);
|
||||
GameplayManager.InitPlayerTypesForPVP(types, names);
|
||||
}
|
||||
|
||||
public void InitBotModeData(PlayerData playerData, int botCount)
|
||||
@ -69,7 +73,7 @@ public class GameModeHandler : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
};
|
||||
|
||||
CurrentGameModeType = GameModeType.Bot;
|
||||
gameplayManager.InitPlayerTypesForBotMatch(playerData, botCount);
|
||||
GameplayManager.InitPlayerTypesForBotMatch(playerData, botCount);
|
||||
}
|
||||
|
||||
public void OnGameRestarted()
|
||||
|
||||
@ -61,7 +61,11 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
get; private set;
|
||||
}
|
||||
private UIManager uIManager;
|
||||
private GameManager gameManager;
|
||||
public GameManager GameManager
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
private GameModeHandler gameModeHandler;
|
||||
|
||||
private int diceRolledValue;
|
||||
@ -70,7 +74,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
private int diceSixRollCounter = 0;
|
||||
|
||||
private List<PlayerPawn> availPlayers = new List<PlayerPawn>();
|
||||
private bool canSwitchPlayer = false;
|
||||
private bool canSwitchPlayer = true;
|
||||
|
||||
public bool CanRollDiceForUser
|
||||
{
|
||||
@ -85,6 +89,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
public List<PlayerData> PlayerDatas => playerDatas;
|
||||
public List<PlayerType> PlayerTypesCollection => allPlayerTypes;
|
||||
|
||||
public Action OnGameResumed = null;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
InterfaceManager.Instance?.RegisterInterface<GameplayManager>(this);
|
||||
@ -95,7 +101,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
{
|
||||
TilesManager = InterfaceManager.Instance.GetInterfaceInstance<TilesManager>();
|
||||
uIManager = InterfaceManager.Instance.GetInterfaceInstance<UIManager>();
|
||||
gameManager = InterfaceManager.Instance.GetInterfaceInstance<GameManager>();
|
||||
GameManager = InterfaceManager.Instance.GetInterfaceInstance<GameManager>();
|
||||
gameModeHandler = InterfaceManager.Instance.GetInterfaceInstance<GameModeHandler>();
|
||||
}
|
||||
|
||||
@ -228,6 +234,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
public void InitCurrentGamePlayerInfo()
|
||||
{
|
||||
currentPlayerTypeTurn = allPlayerTypes[currentPlayerTurnIndex];
|
||||
uIManager.UpdatePlayerTurnText(currentPlayerTypeTurn);
|
||||
Debug.Log($"currentPlayerTypeTurn: {currentPlayerTypeTurn}");
|
||||
|
||||
#if UNITY_EDITOR
|
||||
@ -347,23 +354,18 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
UpdateActivePlayersAndSetDisplay(true);
|
||||
}
|
||||
|
||||
if (availPlayers.Count() < 1 && CanRollDiceAgain) // got a 6 roll value
|
||||
if (CanRollDiceAgain) // got a 6 roll value
|
||||
{
|
||||
pawn = playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values.FirstOrDefault(pawn => pawn.GetPlayerState() == PlayerState.InHome);
|
||||
Debug.Log($"SelectedPawn: {pawn.name}");
|
||||
OnPawnSelected(pawn);
|
||||
|
||||
return;
|
||||
if (pawn != null)
|
||||
{
|
||||
Debug.Log($"SelectedPawn: {pawn.name}");
|
||||
OnPawnSelected(pawn);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO :: Double check
|
||||
foreach (var key in botPawnsDictForCurrentPlayer.Keys)
|
||||
{
|
||||
Debug.Log($"b :: botPawnsDictForCurrentPlayer[key]: {key}, {botPawnsDictForCurrentPlayer[key]}");
|
||||
// botPawnsDictForCurrentPlayer[key] = BotMove.NoMoves;
|
||||
}
|
||||
|
||||
|
||||
Debug.Log($"Before Iterating");
|
||||
foreach (var playerPawn in availPlayers)
|
||||
{
|
||||
@ -518,7 +520,13 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
availPlayers = new List<PlayerPawn>();
|
||||
|
||||
if (!CanRollDiceAgain)
|
||||
{
|
||||
UpdateActivePlayersAndSetDisplay(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
InitActivePlayers();
|
||||
}
|
||||
|
||||
if (rolledVal == Ludo_3D_Constants.Max_Dice_Rolls)
|
||||
{
|
||||
@ -571,6 +579,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
{
|
||||
indexesToRemove.Add(i);
|
||||
availPlayers[i].SetPlayerSelectionState(false);
|
||||
availPlayers[i].ShowPlayerCountCanvas(false);
|
||||
customAvailPlayers--;
|
||||
}
|
||||
|
||||
@ -594,14 +603,18 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
|
||||
private void UpdateActivePlayersAndSetDisplay(bool state)
|
||||
{
|
||||
availPlayers = playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values.Select(pawn => pawn)
|
||||
.Where(pawn => pawn.GetPlayerState() == PlayerState.InSafeZone ||
|
||||
pawn.GetPlayerState() == PlayerState.Moving ||
|
||||
pawn.GetPlayerState() == PlayerState.InFinishingPath).ToList();
|
||||
|
||||
InitActivePlayers();
|
||||
SetDisplayCountForAllAvailPlayers(state);
|
||||
}
|
||||
|
||||
private void InitActivePlayers()
|
||||
{
|
||||
availPlayers = playerGameDatasDict[currentPlayerTypeTurn].playerPawnsDict.Values.Select(pawn => pawn)
|
||||
.Where(pawn => pawn.GetPlayerState() == PlayerState.InSafeZone ||
|
||||
pawn.GetPlayerState() == PlayerState.Moving ||
|
||||
pawn.GetPlayerState() == PlayerState.InFinishingPath).ToList();
|
||||
}
|
||||
|
||||
private bool AreAllPawnsInFinishingPath()
|
||||
{
|
||||
bool areAllPawnsInFinishingPath = false;
|
||||
@ -653,7 +666,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
PlayerGameData playerGameData = playerGameDatasDict[currentPlayerTypeTurn];
|
||||
Debug.Log($"playerPawn.GetPlayerState(): {selectedPawn.GetPlayerState()}");
|
||||
|
||||
|
||||
if (selectedPawn.GetPlayerState() == PlayerState.InHome)
|
||||
{
|
||||
Tile targetTile = TilesManager.RetrieveTileBasedOnIndex(playerGameData.startIndex);
|
||||
@ -721,6 +733,13 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
foreach (var pawn in playerPawnsTest)
|
||||
pawn.MoveToCustomTilePosition(currentSittingSafeTile.CenterPlacementPosition);
|
||||
}
|
||||
|
||||
if (currentSittingSafeTile.ContainsPlayerType(currentPlayerTypeTurn))
|
||||
{
|
||||
var playerPawns = currentSittingSafeTile.GetPlayerPawns(currentPlayerTypeTurn);
|
||||
foreach (var pawn in playerPawns)
|
||||
ShowUpdatedPlayerCountOnTile(pawn);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -774,7 +793,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
Debug.LogError($"GAME IS OVER");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
currentPlayerTurnIndex = allPlayerTypes.FindIndex(type => type == currentPlayerTypeTurn);
|
||||
|
||||
if (currentPlayerTypeTurn == allPlayerTypes[allPlayerTypes.Count - 1])
|
||||
@ -867,14 +886,14 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
{
|
||||
// MoveThroughTiles(playerPawn, index, targetIndex);
|
||||
Debug.Log($"TargetIdx: {targetIndex - index}");
|
||||
MoveThroughFinishingPath(playerPawn, 0, targetIndex - index);
|
||||
CheckForGamePause(() => MoveThroughFinishingPath(playerPawn, 0, targetIndex - index));
|
||||
}
|
||||
else if (nextTileIndex <= targetIndex)
|
||||
{
|
||||
if (nextTileIndex == 0)
|
||||
targetIndex = (targetIndex - playerPawn.CurrentTileIndex) - 1;
|
||||
|
||||
MoveThroughTiles(playerPawn, nextTileIndex, targetIndex);
|
||||
CheckForGamePause(() => MoveThroughTiles(playerPawn, nextTileIndex, targetIndex));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -938,6 +957,20 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
index);
|
||||
}
|
||||
|
||||
public void CheckForGamePause(Action onComplete)
|
||||
{
|
||||
Debug.Log($"CheckForGamePause: {GameManager.CurrentGameState == GameState.IsPaused}");
|
||||
if (gameModeHandler.CurrentGameModeType == GameModeType.Bot && !botTypesInGame.Contains(currentPlayerTypeTurn)
|
||||
&& GameManager.CurrentGameState == GameState.IsPaused)
|
||||
{
|
||||
OnGameResumed = onComplete;
|
||||
}
|
||||
else
|
||||
{
|
||||
onComplete?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void MoveThroughFinishingPath(PlayerPawn playerPawn, int index, int targetIndex)
|
||||
{
|
||||
UpdatePlayerState(playerPawn, PlayerState.InFinishingPath);
|
||||
@ -955,14 +988,14 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
Debug.Log($"tileIndex: {tileIndex}, targetIndex: {targetIndex}");
|
||||
if (tileIndex <= targetIndex)
|
||||
{
|
||||
// MoveThroughTiles(playerPawn, index, targetIndex);
|
||||
MoveThroughFinishingPath(playerPawn, tileIndex, targetIndex);
|
||||
CheckForGamePause(() => MoveThroughFinishingPath(playerPawn, tileIndex, targetIndex));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (playerPawn.CurrentTileIndex == TilesManager.GetFinishingTileDataLength(currentPlayerTypeTurn) - 1)
|
||||
{
|
||||
OnGameResumed = null;
|
||||
Tile tile = TilesManager.RetrieveFinishingTileBasedOnIndex(playerPawn.PlayerType, playerPawn.CurrentTileIndex);
|
||||
tile.InitPlayerPawn(playerPawn, playerPawn.PlayerType);
|
||||
// ShowUpdatedPlayerCountOnTile(playerPawn);
|
||||
@ -995,7 +1028,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
playerDatas.FirstOrDefault(data => data.playerType == lastUnfinishingPlayerType).ranking = TotalPlayersInGame - allPlayerTypes.Count;
|
||||
|
||||
// Show Game Over panel
|
||||
gameManager.OnGameStateChanged(GameState.GameOver);
|
||||
GameManager.OnGameStateChanged(GameState.GameOver);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1076,7 +1109,8 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
public void ResetData()
|
||||
{
|
||||
ResetGameRestartData();
|
||||
|
||||
|
||||
OnGameResumed = null;
|
||||
playerDatas = null;
|
||||
allPlayerTypes = null;
|
||||
|
||||
@ -1091,5 +1125,6 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
public void ResetGameRestartData()
|
||||
{
|
||||
currentPlayerTurnIndex = 0;
|
||||
diceSixRollCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ public class PlayerBase : MonoBehaviour
|
||||
{
|
||||
for (int idx = 0; idx < basePlacementDatas.Length; idx++)
|
||||
{
|
||||
playerPawns[idx].Init(basePlacementDatas[idx], playerType);
|
||||
playerPawns[idx].Init(this, basePlacementDatas[idx], playerType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -23,39 +23,17 @@ public class PlayerPawn : MonoBehaviour
|
||||
[SerializeField] private Animator animator;
|
||||
[SerializeField] private PlayerCountCanvas playerCountCanvas;
|
||||
|
||||
public PlayerCountCanvas PlayerCountCanvas => playerCountCanvas;
|
||||
|
||||
public bool CanSelectPlayer
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
private PlayerBase playerBase;
|
||||
private GameplayManager gameplayManager;
|
||||
|
||||
public int CurrentTileIndex
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public int PlayerId
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public PlayerType PlayerType
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public bool IsBotPlayer
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public int StepsTaken
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public PlayerCountCanvas PlayerCountCanvas => playerCountCanvas;
|
||||
|
||||
public int PlayerId { get; private set; }
|
||||
public int StepsTaken { get; private set; }
|
||||
public int CurrentTileIndex { get; private set; }
|
||||
public bool IsBotPlayer { get; private set; }
|
||||
public bool CanSelectPlayer { get; private set; }
|
||||
public PlayerType PlayerType { get; private set; }
|
||||
|
||||
public void AssignBotPlayerState(bool state)
|
||||
{
|
||||
@ -120,8 +98,14 @@ public class PlayerPawn : MonoBehaviour
|
||||
// transform.LookAt(transform.position + lookDirection);
|
||||
transform.DOLookAt(transform.position + lookDirection, 0.2f);
|
||||
}
|
||||
|
||||
onComplete?.Invoke();
|
||||
|
||||
Debug.Log($"Dotween:: MoveToTile.OnComplete {PlayerType}, {transform.position}: {StepsTaken != 0}");
|
||||
if (StepsTaken != 0)
|
||||
onComplete?.Invoke();
|
||||
else
|
||||
{
|
||||
transform.position = playerBase.GetBasePlacementDataPosition(PlayerId - 1).position;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -137,6 +121,7 @@ public class PlayerPawn : MonoBehaviour
|
||||
transform.position = transformData.position;
|
||||
transform.rotation = transformData.rotation;
|
||||
SetPlayerState(PlayerState.InHome);
|
||||
ShowPlayerCountCanvas(false);
|
||||
StepsTaken = 0;
|
||||
}
|
||||
|
||||
@ -149,9 +134,9 @@ public class PlayerPawn : MonoBehaviour
|
||||
|
||||
private void OnMouseDown()
|
||||
{
|
||||
if (IsBotPlayer || !CanSelectPlayer) return;
|
||||
|
||||
SetGameplayManager();
|
||||
if (gameplayManager.GameManager.CurrentGameState == GameState.IsPaused || IsBotPlayer || !CanSelectPlayer) return;
|
||||
|
||||
gameplayManager.OnPawnSelected(this);
|
||||
}
|
||||
|
||||
@ -160,8 +145,9 @@ public class PlayerPawn : MonoBehaviour
|
||||
gameplayManager = gameplayManager ?? InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
||||
}
|
||||
|
||||
public void Init(BasePlacementData basePlacementData, PlayerType playerType)
|
||||
public void Init(PlayerBase playerBase, BasePlacementData basePlacementData, PlayerType playerType)
|
||||
{
|
||||
this.playerBase = playerBase;
|
||||
PlayerId = basePlacementData.playerBaseId;
|
||||
PlayerType = playerType;
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ public enum GameState
|
||||
{
|
||||
InMenu,
|
||||
InGame,
|
||||
IsPaused,
|
||||
GameOver,
|
||||
}
|
||||
|
||||
@ -14,7 +15,7 @@ public class GameManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
private MusicManager musicManager;
|
||||
private GameplayManager gameplayManager;
|
||||
|
||||
public GameState GameState
|
||||
public GameState CurrentGameState
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
@ -36,10 +37,16 @@ public class GameManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
OnGameStateChanged(GameState.InMenu);
|
||||
}
|
||||
|
||||
public void SetGameState(GameState gameState)
|
||||
{
|
||||
Debug.Log($"### GameState: {gameState}");
|
||||
PrevGameState = CurrentGameState;
|
||||
CurrentGameState = gameState;
|
||||
}
|
||||
|
||||
public void OnGameStateChanged(GameState gameState)
|
||||
{
|
||||
PrevGameState = GameState;
|
||||
GameState = gameState;
|
||||
SetGameState(gameState);
|
||||
Debug.Log($"OnGameStateChanged: {gameState}");
|
||||
switch (gameState)
|
||||
{
|
||||
@ -49,8 +56,12 @@ public class GameManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
uiManager.OnInMenuScreen();
|
||||
break;
|
||||
case GameState.InGame:
|
||||
Debug.Log($"Logging in-game state");
|
||||
musicManager.PlayMusicClip(MusicType.GameMusic);
|
||||
uiManager.OnInGameScreen();
|
||||
break;
|
||||
case GameState.IsPaused:
|
||||
|
||||
break;
|
||||
case GameState.GameOver:
|
||||
musicManager.PlayMusicClip(MusicType.GameOverMusic);
|
||||
|
||||
@ -2,10 +2,16 @@ using UnityEngine;
|
||||
|
||||
public class UIManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
{
|
||||
private GameplayManager gameplayManager;
|
||||
private ScreenManager screenManager;
|
||||
private PopupManager popupManager;
|
||||
|
||||
private GameplayManager gameplayManager;
|
||||
|
||||
public GameManager GameManager
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
InterfaceManager.Instance.RegisterInterface<UIManager>(this);
|
||||
@ -13,8 +19,9 @@ public class UIManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
|
||||
|
||||
public void InitializeData()
|
||||
{
|
||||
gameplayManager = InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
||||
GameManager = InterfaceManager.Instance.GetInterfaceInstance<GameManager>();
|
||||
popupManager = InterfaceManager.Instance.GetInterfaceInstance<PopupManager>();
|
||||
gameplayManager = InterfaceManager.Instance.GetInterfaceInstance<GameplayManager>();
|
||||
}
|
||||
|
||||
public void OnDiceViewInteracted()
|
||||
|
||||
@ -8,7 +8,7 @@ public class PauseMenuPopup : PopupBase
|
||||
[SerializeField] private Button playBtn;
|
||||
[SerializeField] private Button restartBtn;
|
||||
|
||||
private GameManager gameManager;
|
||||
private UIManager uiManager;
|
||||
private SoundManager soundManager;
|
||||
private GameModeHandler gameModeHandler;
|
||||
|
||||
@ -28,6 +28,9 @@ public class PauseMenuPopup : PopupBase
|
||||
|
||||
private void OnClick_PlayButton()
|
||||
{
|
||||
SetUIManager();
|
||||
uiManager.GameManager.SetGameState(GameState.InGame);
|
||||
|
||||
soundManager = soundManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<SoundManager>() : soundManager;
|
||||
soundManager?.PlayGameSoundClip(SoundType.ButtonClick);
|
||||
|
||||
@ -35,6 +38,9 @@ public class PauseMenuPopup : PopupBase
|
||||
|
||||
ScreenManager screenManager = InterfaceManager.Instance?.GetInterfaceInstance<ScreenManager>();
|
||||
screenManager.ShowScreen(ScreenType.InGameHUDScreen);
|
||||
|
||||
SetGameModeHandler();
|
||||
gameModeHandler.GameplayManager.OnGameResumed?.Invoke();
|
||||
}
|
||||
|
||||
private void OnClick_HomeButton()
|
||||
@ -44,8 +50,13 @@ public class PauseMenuPopup : PopupBase
|
||||
|
||||
popupManager.HidePopup(popupType);
|
||||
|
||||
gameManager = InterfaceManager.Instance?.GetInterfaceInstance<GameManager>();
|
||||
gameManager.OnGameStateChanged(GameState.InMenu);
|
||||
SetUIManager();
|
||||
uiManager.GameManager.OnGameStateChanged(GameState.InMenu);
|
||||
}
|
||||
|
||||
private void SetUIManager()
|
||||
{
|
||||
uiManager = uiManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<UIManager>() : uiManager;
|
||||
}
|
||||
|
||||
private void OnClick_RestartButton()
|
||||
|
||||
@ -17,31 +17,40 @@ public class GameHUDS : ScreenBase
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
pauseBtn.onClick.AddListener(OnClick_pauseBtn);
|
||||
diceBtn.onClick.AddListener(OnClick_DiceBtn);
|
||||
pauseBtn.onClick.AddListener(OnClick_PauseButton);
|
||||
diceBtn.onClick.AddListener(OnClick_DiceButton);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
pauseBtn.onClick.RemoveListener(OnClick_pauseBtn);
|
||||
diceBtn.onClick.RemoveListener(OnClick_DiceBtn);
|
||||
pauseBtn.onClick.RemoveListener(OnClick_PauseButton);
|
||||
diceBtn.onClick.RemoveListener(OnClick_DiceButton);
|
||||
}
|
||||
|
||||
private void OnClick_pauseBtn()
|
||||
private void OnClick_PauseButton()
|
||||
{
|
||||
PopupManager popupManager = InterfaceManager.Instance?.GetInterfaceInstance<PopupManager>();
|
||||
popupManager.ShowPopup(PopupType.PauseMenuPopup);
|
||||
|
||||
soundManager = soundManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<SoundManager>() : soundManager;
|
||||
soundManager?.PlayGameSoundClip(SoundType.ButtonClick);
|
||||
|
||||
Hide();
|
||||
screenManager.HideScreen(screenType);
|
||||
|
||||
PopupManager popupManager = InterfaceManager.Instance?.GetInterfaceInstance<PopupManager>();
|
||||
popupManager.ShowPopup(PopupType.PauseMenuPopup);
|
||||
|
||||
SetUIManager();
|
||||
uiManager.GameManager.SetGameState(GameState.IsPaused);
|
||||
}
|
||||
|
||||
private void OnClick_DiceBtn()
|
||||
private void OnClick_DiceButton()
|
||||
{
|
||||
SetUIManager();
|
||||
|
||||
uiManager.OnDiceViewInteracted();
|
||||
}
|
||||
|
||||
private void SetUIManager()
|
||||
{
|
||||
uiManager = uiManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<UIManager>() : uiManager;
|
||||
uiManager.OnDiceViewInteracted();
|
||||
}
|
||||
|
||||
public void UpdatePlayerTurnText(PlayerType playerType)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user