Refix: Dice roll.

This commit is contained in:
Ashby Issac 2026-01-29 22:16:54 +05:30
parent 4fd71569ef
commit f8eed62a9f

View File

@ -238,7 +238,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
{ {
Debug.Log($"Switching player"); Debug.Log($"Switching player");
SwitchPlayer(); SwitchPlayer();
SetCanRollDiceForUser(currentPlayerTypeTurn, true); SetCanRollDiceForUser(true);
} }
} }
@ -425,7 +425,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
public void OnDiceRolled(int rolledVal) public void OnDiceRolled(int rolledVal)
{ {
SetCanRollDiceForUser(currentPlayerTypeTurn, false); SetCanRollDiceForUser(false);
// add core dice logic here // add core dice logic here
Debug.Log($"Tile Index :: LUDO :: rolledVal: {rolledVal} :: {currentPlayerTypeTurn}"); Debug.Log($"Tile Index :: LUDO :: rolledVal: {rolledVal} :: {currentPlayerTypeTurn}");
@ -449,7 +449,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
Debug.Log($"### AreAllPawnsInFinishingPath"); Debug.Log($"### AreAllPawnsInFinishingPath");
if (AreAllPawnsInFinishingPath()) if (AreAllPawnsInFinishingPath())
{ {
SetCanRollDiceForUser(currentPlayerTypeTurn, true); SetCanRollDiceForUser(true);
return; return;
} }
@ -570,7 +570,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
if (playerPawn.IsBotPlayer) if (playerPawn.IsBotPlayer)
CheckDiceRollForBot(playerPawn); CheckDiceRollForBot(playerPawn);
else else
SetCanRollDiceForUser(playerPawn.PlayerType, true); SetCanRollDiceForUser(true);
}, playerGameData.startIndex); }, playerGameData.startIndex);
@ -670,6 +670,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
diceText.text = $"{0}"; diceText.text = $"{0}";
} }
SetCanRollDiceForUser(!botTypesInGame.Contains(currentPlayerTypeTurn));
Debug.Log($"CurrentPlayerTurn: {currentPlayerTypeTurn}"); Debug.Log($"CurrentPlayerTurn: {currentPlayerTypeTurn}");
var tempPos = playerBaseHandler.GetPlayerBase(currentPlayerTypeTurn).transform.position; var tempPos = playerBaseHandler.GetPlayerBase(currentPlayerTypeTurn).transform.position;
pointerDebug.position = new Vector3(tempPos.x, 3f, tempPos.z); pointerDebug.position = new Vector3(tempPos.x, 3f, tempPos.z);
@ -771,7 +772,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
if (playerPawn.IsBotPlayer) if (playerPawn.IsBotPlayer)
CheckDiceRollForBot(playerPawn); CheckDiceRollForBot(playerPawn);
else else
SetCanRollDiceForUser(playerPawn.PlayerType, true); SetCanRollDiceForUser(true);
} }
nextTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn); nextTile.InitPlayerPawn(playerPawn, currentPlayerTypeTurn);
@ -791,7 +792,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
SwitchPlayer(playerPawn); SwitchPlayer(playerPawn);
if (!CanRollDiceAgain) if (!CanRollDiceAgain)
{ {
SetCanRollDiceForUser(playerPawn.PlayerType, true); SetCanRollDiceForUser(true);
} }
} }
}, },
@ -906,22 +907,22 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
{ {
if (CheckForMaxDiceRollAttempt()) if (CheckForMaxDiceRollAttempt())
{ {
SetCanRollDiceForUser(playerPawn.PlayerType, true); SetCanRollDiceForUser(true);
return; return;
} }
SwitchPlayer(); SwitchPlayer();
} }
SetCanRollDiceForUser(playerPawn.PlayerType, true); SetCanRollDiceForUser(true);
} }
}, },
index); index);
} }
private void SetCanRollDiceForUser(PlayerType playerType, bool state) private void SetCanRollDiceForUser(bool state)
{ {
if (botTypesInGame.Contains(playerType)) return; // if (botTypesInGame.Contains(playerType)) return;
CanRollDice = state; CanRollDice = state;
} }