/// <summary> /// Give the target character an amount of XP /// </summary> /// <param name="amount">How much XP</param> /// <param name="target">The target interface</param> public static void ExampleGiveXp(int amount, IUseStats target) { // Level Up the character if the input amount exceeds their next maximum. int val = (int)target.Stats[(int)StatType.Experience].Get(StatProperty.Value) + amount; if (val >= target.Stats[(int)StatType.Experience].Get(StatProperty.Max)) { target.Stats[(int)StatType.Experience].AddToRoot(StatProperty.Value, amount); target.LevelUp(); } else { target.Stats[(int)StatType.Experience].AddToRoot(StatProperty.Value, amount); } }