Ejemplo n.º 1
0
 /// <summary>
 /// Sets the Linker to listen to the passed stat's value change
 /// event and set's the value of LinkedStat.
 /// </summary>
 private void SetLinkedStat(RPGStat stat)
 {
     if (stat == null)
     {
         Debug.LogWarning("Stat Linker was created with null reference to a stat.");
     }
     LinkedStat = stat;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RPGSystems.StatSystem.RPGStatLinker"/> class.
        /// </summary>
        /// <param name="stat">Stat.</param>
        public RPGStatLinker(RPGStat stat)
        {
            this._stat = stat;
            IStatValueChange iValueChange = this._stat as IStatValueChange;

            if (iValueChange != null)
            {
                iValueChange.OnValueChange += OnLinkStatValueChange;
            }
        }
Ejemplo n.º 3
0
 public RPGStatLinkerBasic(RPGStatLinkerBasicAsset asset, RPGStat linkedStat) : base(asset, linkedStat)
 {
     this._ratio = asset.Ratio;
 }
Ejemplo n.º 4
0
 public abstract RPGStatLinker CreateInstance(RPGStat linkedStat);
Ejemplo n.º 5
0
 /// <summary>
 /// Trys to get the RPGStat with the given RPGStatTypeId.
 /// If stat exists, returns true.
 /// </summary>
 public bool TryGetStat(int statTypeId, out RPGStat stat)
 {
     stat = GetStat(statTypeId);
     return(stat != null);
 }
 public RPGStatLinkerBasic(RPGStat stat, float ratio) : base(stat)
 {
     this.ratio = ratio;
 }
Ejemplo n.º 7
0
 static public bool TryGetStat(this RPGStatCollection collection, RPGStatType statType, out RPGStat stat)
 {
     return(collection.TryGetStat((int)statType, out stat));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Basic constructor that only takes a stat linker asset and
 /// a linked stat. Listens to the Stat's OnValueChange
 /// event if the stat implements IStatValueChange.
 /// </summary>
 public RPGStatLinker(RPGStatLinkerAsset asset, RPGStat linkedStat)
 {
     SetLinkedStat(linkedStat);
 }
Ejemplo n.º 9
0
 public override RPGStatLinker CreateInstance(RPGStat linkedStat)
 {
     return(new RPGStatLinkerBasic(this, linkedStat));
 }