FiE-Game/Assets/Scripts/Fie/Utility/FieRandom.cs

32 lines
517 B
C#
Raw Normal View History

2018-11-20 20:10:49 +01:00
using UnityEngine;
namespace Fie.Utility
{
public class FieRandom
{
private static void InitRandomSeed()
{
if (PhotonNetwork.room != null)
{
Random.seed = (PhotonNetwork.room.name + PhotonNetwork.time.ToString()).GetHashCode();
}
else
{
Random.seed = (int)Time.time;
}
}
public static int Range(int a, int b)
{
InitRandomSeed();
return Random.Range(a, b);
}
public static float Range(float a, float b)
{
InitRandomSeed();
return Random.Range(a, b);
}
}
}