public virtual void Initialize(IUseStats owner) { Owner = owner; IsReady = true; Modifiers = new List <StatModifier>(); DoUpdate(); }
public void Awake() { if (TargetGo) { Target = TargetGo.GetComponent <IUseStats>(); } if (Name) { Name.text = TargetGo.GetComponent <StatsCharacter>().MyTitle; } }
/// <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); } }
/// <summary> /// Example of checking stats to see if something is below 20% health. /// </summary> public static bool ExampleIsWeak(IUseStats target) { return(target.GetStatValue(StatType.Health) < target.GetStatMax(StatType.Health) / 4); }