using UnityEngine;
[System.Serializable]
public class Seed {
public string seedString = "";
private int _seed = 0;
public int value {
get {
ConvertSeed();
return _seed;
}
set {
seedString = value.ToString();
ConvertSeed();
}
}
void ConvertSeed() {
if (seedString.Length == 0) {
seedString = System.Environment.TickCount.ToString();
}
if (!int.TryParse(seedString, out _seed)) {
_seed = seedString.GetHashCode();
}
}
public void Init() {
ConvertSeed();
Random.InitState(_seed);
}
public void setSeedString(string x) {
seedString = x;
}
}