Baked Lighting maps
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
@@ -10,6 +11,7 @@ public class Dice : MonoBehaviour
|
||||
[SerializeField] private TMP_Text[] numbers;
|
||||
[SerializeField] private Rigidbody rb;
|
||||
private bool started;
|
||||
private float timeLastNumberChanged = 0;
|
||||
|
||||
|
||||
private void Start()
|
||||
@@ -17,6 +19,17 @@ public class Dice : MonoBehaviour
|
||||
rb.useGravity = false;
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if(started)
|
||||
{
|
||||
if (Time.time - timeLastNumberChanged >= .100f)
|
||||
{
|
||||
RandomNumbers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StartRandom()
|
||||
{
|
||||
@@ -25,15 +38,13 @@ public class Dice : MonoBehaviour
|
||||
rb.useGravity = false;
|
||||
gameObject.SetActive(true);
|
||||
started = true;
|
||||
InvokeRepeating("RandomNumbers", 0f, 0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
public void StopRandom(int dec)
|
||||
{
|
||||
started = false;
|
||||
CancelInvoke("RandomNumbers");
|
||||
|
||||
|
||||
rb.angularVelocity = new Vector3(5, 5, 5);
|
||||
rb.useGravity = true;
|
||||
|
||||
@@ -45,6 +56,7 @@ public class Dice : MonoBehaviour
|
||||
|
||||
private void RandomNumbers()
|
||||
{
|
||||
timeLastNumberChanged = Time.time;
|
||||
int random = Random.Range(1, 7);
|
||||
|
||||
rb.angularVelocity = new Vector3(5, 5, 5);
|
||||
|
||||
Reference in New Issue
Block a user