Update
This commit is contained in:
24
Assets/Scripts/Player/Generic/Utils/vRandomFloat.cs
Normal file
24
Assets/Scripts/Player/Generic/Utils/vRandomFloat.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
namespace Invector.Utils
|
||||
{
|
||||
public class vRandomFloat : MonoBehaviour
|
||||
{
|
||||
public bool randomValue = true;
|
||||
[vHideInInspector("randomValue")]
|
||||
public float min;
|
||||
public float max;
|
||||
public bool setOnStart;
|
||||
|
||||
public UnityEngine.UI.Slider.SliderEvent onSet;
|
||||
private void Start()
|
||||
{
|
||||
if (setOnStart) Set();
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
public void Set()
|
||||
{
|
||||
if (randomValue) onSet.Invoke(Random.Range(min, max));
|
||||
else onSet.Invoke(max);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user