コード例 #1
0
 /// <summary>
 /// Removes the stat modifier.
 /// </summary>
 /// <param name="target">Target.</param>
 /// <param name="mod">Mod.</param>
 /// <param name="update">If set to <c>true</c> update.</param>
 public void RemoveStatModifier(RPGStatType target, RPGStatModifier mod, bool update)
 {
     if (ContainStat(target))
     {
         var modStat = GetStat(target) as IStatModifiable;
         if (modStat != null)
         {
             modStat.RemoveModifier(mod);
             if (update == true)
             {
                 modStat.UpdateModifiers();
             }
         }
         else
         {
             Debug.Log("[RPGStatCollection] Trying to remove Stat Modifier to non modifiable stat\"" + target.ToString() + "\"");
         }
     }
     else
     {
         Debug.Log("[RPGStatCollection] Trying to remove Stat Modifier to \"" + target.ToString() + "\", but RPGStatCollection does not contain that stat");
     }
 }
コード例 #2
0
 /// <summary>
 /// Removes a Stat Modifier to the Target stat and then updates the stat's value.
 /// </summary>
 public void RemoveStatModifier(int targetId, RPGStatModifier mod, bool update)
 {
     if (ContainStat(targetId))
     {
         var modStat = GetStat(targetId) as IStatModifiable;
         if (modStat != null)
         {
             modStat.RemoveModifier(mod);
             mod.OnModifierRemove();
             if (update == true)
             {
                 modStat.UpdateModifiers();
             }
         }
         else
         {
             Debug.Log("[RPGStats] Trying to remove Stat Modifier from non modifiable stat \"" + targetId.ToString() + "\"");
         }
     }
     else
     {
         Debug.Log("[RPGStats] Trying to remove Stat Modifier from \"" + targetId.ToString() + "\", but RPGStatCollection does not contain that stat");
     }
 }
コード例 #3
0
 /// <summary>
 /// Adds a Stat Modifier to the Target stat and then updates the stat's value.
 /// </summary>
 public void AddStatModifier(int targetId, RPGStatModifier mod, bool update)
 {
     if (ContainStat(targetId))
     {
         var modStat = GetStat(targetId) as IStatModifiable;
         if (modStat != null)
         {
             modStat.AddModifier(mod);
             mod.OnModifierApply(this, targetId);
             if (update == true)
             {
                 modStat.UpdateModifiers();
             }
         }
         else
         {
             Debug.Log("[RPGStats] Trying to add Stat Modifier to non modifiable stat \"" + targetId.ToString() + "\"");
         }
     }
     else
     {
         Debug.Log("[RPGStats] Trying to add Stat Modifier to \"" + targetId.ToString() + "\", but RPGStats does not contain that stat");
     }
 }
コード例 #4
0
 /// <summary>
 /// Removes the stat modifier.
 /// </summary>
 /// <param name="target">Target.</param>
 /// <param name="mod">Mod.</param>
 public void RemoveStatModifier(RPGStatType target, RPGStatModifier mod)
 {
     RemoveStatModifier(target, mod, false);
 }
コード例 #5
0
 /// <summary>
 /// Adds the modifier.
 /// </summary>
 /// <param name="target">Target.</param>
 /// <param name="mod">Mod.</param>
 public void AddModifier(RPGStatType target, RPGStatModifier mod)
 {
     AddModifier(target, mod, false);
 }
コード例 #6
0
 /// <summary>
 /// Removes the modifier.
 /// </summary>
 /// <param name="mod">Mod.</param>
 public void RemoveModifier(RPGStatModifier mod)
 {
     _statMods.Remove(mod);
     mod.OnValueChange -= OnModValueChange;
 }
コード例 #7
0
 /// <summary>
 /// Adds the modifier.
 /// </summary>
 /// <param name="mod">Mod.</param>
 public void AddModifier(RPGStatModifier mod)
 {
     _statMods.Add(mod);
     mod.OnValueChange += OnModValueChange;
 }
コード例 #8
0
 /// <summary>
 /// Removes a Stat Modifier to the Target stat.
 /// </summary>
 public void RemoveStatModifier(int targetId, RPGStatModifier mod)
 {
     RemoveStatModifier(targetId, mod, false);
 }
コード例 #9
0
 /// <summary>
 /// Removes modifier from stat and stops listening to value change event
 /// </summary>
 public void RemoveModifier(RPGStatModifier mod)
 {
     mod.RemoveValueListener(OnModValueChange);
     _statMods.Remove(mod);
 }
コード例 #10
0
 /// <summary>
 /// Adds a Stat Modifier to the Target stat.
 /// </summary>
 public void AddStatModifier(int targetId, RPGStatModifier mod)
 {
     AddStatModifier(targetId, mod, false);
 }
コード例 #11
0
 /// <summary>
 /// Adds Modifier to stat and listens to the mod's value change event
 /// </summary>
 public void AddModifier(RPGStatModifier mod)
 {
     _statMods.Add(mod);
     mod.AddValueListener(OnModValueChange);
 }
コード例 #12
0
 /// <summary>
 /// Used to listen to the applied stat modifier OnValueChange events
 /// </summary>
 private void OnModValueChange(RPGStatModifier mod)
 {
     UpdateModifiers();
 }
コード例 #13
0
 public RPGStatModifierContext(int assignedStatId, RPGStatModifier modifier)
 {
     this.AssignedStatId = assignedStatId;
     this.StatModifier   = modifier;
 }
コード例 #14
0
 static public void RemoveStatModifier(this RPGStatCollection collection, RPGStatType statType, RPGStatModifier mod, bool update)
 {
     collection.RemoveStatModifier((int)statType, mod, update);
 }
コード例 #15
0
 static public void AddStatModifier(this RPGStatCollection collection, RPGStatType statType, RPGStatModifier mod)
 {
     collection.AddStatModifier((int)statType, mod);
 }