Simple random dice game

Let's set up a very simple dice game in a new scene where a random number between 1 and 6 is generated, and checked against the input value. The player wins if the input value matches the dice result generated randomly, as shown in the following DiceGame.cs file:

public class DiceGame : MonoBehaviour {    public string inputValue = "1";    public Text outputText;    public InputField inputField;    public Button button;    int throwNormalDice() {    Debug.Log("Throwing dice...");    Debug.Log("Finding random between 1 to 6...");    int diceResult = Random.Range(1,7);        Debug.Log("Result: " + diceResult);        return diceResult;   }    int throwLoadedDice() {    Debug.Log("Throwing dice...");        int randomProbability = Random.Range(1,101); int diceResult ...

Get Unity Artificial Intelligence Programming - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.