/// <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; }
/// <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; } }
public RPGStatLinkerBasic(RPGStatLinkerBasicAsset asset, RPGStat linkedStat) : base(asset, linkedStat) { this._ratio = asset.Ratio; }
public abstract RPGStatLinker CreateInstance(RPGStat linkedStat);
/// <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; }
static public bool TryGetStat(this RPGStatCollection collection, RPGStatType statType, out RPGStat stat) { return(collection.TryGetStat((int)statType, out stat)); }
/// <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); }
public override RPGStatLinker CreateInstance(RPGStat linkedStat) { return(new RPGStatLinkerBasic(this, linkedStat)); }