Restrict Dice roll interaction

This commit is contained in:
Sivasankar 2026-02-12 14:38:40 +05:30
parent fc4aeda01c
commit 3f68064a5f
2 changed files with 10 additions and 0 deletions

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections; using System.Collections;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
public class DiceView : MonoBehaviour, IBase public class DiceView : MonoBehaviour, IBase
{ {
@ -10,6 +11,7 @@ public class DiceView : MonoBehaviour, IBase
[SerializeField] private DiceSide[] diceSides; [SerializeField] private DiceSide[] diceSides;
[SerializeField] private float sideValueTime = 1.2f; [SerializeField] private float sideValueTime = 1.2f;
[SerializeField] private Vector3 startPos = new Vector3(0, 20, 0); [SerializeField] private Vector3 startPos = new Vector3(0, 20, 0);
[SerializeField] private Button diceButton;
[Header("Physics Randomness")] [Header("Physics Randomness")]
[SerializeField] private float baseSpinForce = 900f; [SerializeField] private float baseSpinForce = 900f;
@ -102,6 +104,12 @@ public class DiceView : MonoBehaviour, IBase
rolling = false; rolling = false;
} }
public void SetDiceButtonInteraction(bool status)
{
diceButton.interactable = status;
}
public void ResetOnSessionEnd() public void ResetOnSessionEnd()
{ {
ResetDice(); ResetDice();

View File

@ -240,6 +240,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
playerBaseHandler.ShowSelectedPlayerBase(currentPlayerTypeTurn, false); playerBaseHandler.ShowSelectedPlayerBase(currentPlayerTypeTurn, false);
currentPlayerTypeTurn = playerType; currentPlayerTypeTurn = playerType;
playerBaseHandler.ShowSelectedPlayerBase(currentPlayerTypeTurn, true); playerBaseHandler.ShowSelectedPlayerBase(currentPlayerTypeTurn, true);
diceRollHandler.DiceView.SetDiceButtonInteraction(true);
UpdateTurnTimer(); UpdateTurnTimer();
} }
@ -573,6 +574,7 @@ public class GameplayManager : MonoBehaviour, IBase, IBootLoader, IDataLoader
public void OnDiceRolled(int rolledVal) public void OnDiceRolled(int rolledVal)
{ {
SetCanRollDiceForUser(false); SetCanRollDiceForUser(false);
diceRollHandler.DiceView.SetDiceButtonInteraction(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}");