mirror of
https://github.com/smyalygames/monopoly.git
synced 2025-05-18 14:24:12 +02:00
39 lines
755 B
C#
39 lines
755 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class RollDice : MonoBehaviour
|
|
{
|
|
System.Random random = new System.Random();
|
|
|
|
private int current;
|
|
private Waypoints waypoints;
|
|
|
|
|
|
public Button m_RollDice;
|
|
|
|
void Awake()
|
|
{
|
|
waypoints = GameObject.FindObjectOfType<Waypoints>();
|
|
}
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
m_RollDice.onClick.AddListener(TaskOnClick);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
void TaskOnClick() {
|
|
current = random.Next(1, 7) + random.Next(1, 7);
|
|
Debug.Log("Rolled: " + current);
|
|
waypoints.UpdateRoll(current);
|
|
}
|
|
}
|