You've already forked taptap2024_GJ_chidouren
init
This commit is contained in:
47
Assets/Scripts/System/RandomPool/RandomUtils.cs
Normal file
47
Assets/Scripts/System/RandomPool/RandomUtils.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace System.RandomPool
|
||||
{
|
||||
public static class RandomUtils
|
||||
{
|
||||
public static float RandomFloat ()
|
||||
{
|
||||
return 1 - UnityEngine.Random.Range (0 , 1f);
|
||||
}
|
||||
|
||||
public static bool HasRandom (float rota)
|
||||
{
|
||||
if (rota <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rota >= 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return RandomFloat () <= rota;
|
||||
}
|
||||
|
||||
public static int RandomInt (int min, int max)
|
||||
{
|
||||
return UnityEngine.Random.Range (min, max);
|
||||
}
|
||||
|
||||
public static float RandomFloat (float min, float max)
|
||||
{
|
||||
return UnityEngine.Random.Range (min, max);
|
||||
}
|
||||
|
||||
public static int Range (int randomCountX, int randomCountY)
|
||||
{
|
||||
return RandomInt (randomCountX, randomCountY);
|
||||
}
|
||||
|
||||
public static float RandomFormVector (Vector2 range)
|
||||
{
|
||||
return RandomFloat (range.x, range.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user