public NatureData RandomNature(int maxLevel) { NatureData natureData = new NatureData(); NatureType natureType = (NatureType)UnityEngine.Random.Range(1, Enum.GetValues(typeof(NatureType)).Length); natureData.natureType = natureType; natureData.level = UnityEngine.Random.Range(1, maxLevel); return(natureData); }
/// <summary> /// Checks if the given Stat is set in the given Nature. /// Returns '0.9 | 1.0 | 1.1'. /// </summary> /// <param name="Nature">Nature</param> /// <param name="Stat">Stat</param> /// <returns>Value</returns> public static float GetValue(P_Nature Nature, P_Stats_All Stat) { NatureData NData = NatureData.GetData(Nature); if (NData.IncreasedStat == Stat) { return(1.1f); } else if (NData.DecreasedStat == Stat) { return(0.9f); } return(1f); }
public static NatureData getNature(string name) { NatureData result = null; name = name.ToUpper(); int i = 0; while (result == null) { if (i >= natures.Length) { return(null); } else if (natures[i].getName() == name) { result = natures[i]; } i += 1; } return(result); }
/// <summary> /// Returns a random Nature from the Database. /// Starts at 1 because of the placeholder /// </summary> /// <returns>random Nature</returns> public static P_Nature GetRandomNature() { return(NatureData.GetData(Random.Range(1, NatureData.GetDatabase().Length - 1)).Nature); }