23 lines
613 B
C#
23 lines
613 B
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class DiceRoller : MonoBehaviour
|
||
|
|
{
|
||
|
|
private InputManager inputManager;
|
||
|
|
|
||
|
|
private void OnMouseDown()
|
||
|
|
{
|
||
|
|
inputManager = inputManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<InputManager>() : inputManager;
|
||
|
|
if (!inputManager.GameplayManager.CanRollDice) return;
|
||
|
|
|
||
|
|
OnDiceRolled();
|
||
|
|
}
|
||
|
|
|
||
|
|
private void OnDiceRolled()
|
||
|
|
{
|
||
|
|
int currentRolledVal = Random.Range(1, Ludo_3D_Constants.Max_Dice_Rolls + 1);
|
||
|
|
inputManager.SetDiceRollValue(currentRolledVal);
|
||
|
|
}
|
||
|
|
}
|