Example #1
0
 public virtual void Initialize(IUseStats owner)
 {
     Owner     = owner;
     IsReady   = true;
     Modifiers = new List <StatModifier>();
     DoUpdate();
 }
Example #2
0
 public void Awake()
 {
     if (TargetGo)
     {
         Target = TargetGo.GetComponent <IUseStats>();
     }
     if (Name)
     {
         Name.text = TargetGo.GetComponent <StatsCharacter>().MyTitle;
     }
 }
Example #3
0
        /// <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);
            }
        }
Example #4
0
 /// <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);
 }