Implemented dice rolling.
This commit is contained in:
parent
4bd34a1335
commit
2b08dc425f
15 changed files with 1419 additions and 4 deletions
18
PuzzleGameProject/Assets/Scripts/Die.cs
Normal file
18
PuzzleGameProject/Assets/Scripts/Die.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Die : MonoBehaviour
|
||||
{
|
||||
private int _result = 0;
|
||||
|
||||
public void SetResult(int result) {
|
||||
_result = result;
|
||||
gameObject.GetComponentInChildren<TextMeshProUGUI>().text = _result.ToString();
|
||||
}
|
||||
|
||||
public void ClearDie() {
|
||||
gameObject.GetComponent<TextMeshProUGUI>().text = String.Empty;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue