diff --git a/Runtime/BaseStatModifierImmutableSet.cs b/Runtime/BaseReadOnlyStatModifierSet.cs
similarity index 95%
rename from Runtime/BaseStatModifierImmutableSet.cs
rename to Runtime/BaseReadOnlyStatModifierSet.cs
index c7f1843..c438192 100644
--- a/Runtime/BaseStatModifierImmutableSet.cs
+++ b/Runtime/BaseReadOnlyStatModifierSet.cs
@@ -10,7 +10,7 @@ namespace Gameframe.StatSheet
/// Stat modifiers are adds or multipliers that can be applied to a stat sheet
///
///
- public abstract class BaseStatModifierImmutableSet : IStatModifierSet
+ public abstract class BaseReadOnlyStatModifierSet : IReadOnlyStatModifierSet
{
///
/// Get modifier for a given stat type and mode
@@ -59,4 +59,4 @@ IEnumerator IEnumerable.GetEnumerator()
return GetEnumerator();
}
}
-}
\ No newline at end of file
+}
diff --git a/Runtime/BaseStatModifierImmutableSet.cs.meta b/Runtime/BaseReadOnlyStatModifierSet.cs.meta
similarity index 100%
rename from Runtime/BaseStatModifierImmutableSet.cs.meta
rename to Runtime/BaseReadOnlyStatModifierSet.cs.meta
diff --git a/Runtime/BaseStatModifierMutableSet.cs b/Runtime/BaseStatModifierSet.cs
similarity index 97%
rename from Runtime/BaseStatModifierMutableSet.cs
rename to Runtime/BaseStatModifierSet.cs
index 6c956b7..69a4990 100644
--- a/Runtime/BaseStatModifierMutableSet.cs
+++ b/Runtime/BaseStatModifierSet.cs
@@ -5,7 +5,7 @@
namespace Gameframe.StatSheet
{
- public abstract class BaseStatModifierMutableSet : INotifyStatModifierSet
+ public abstract class BaseStatModifierSet : INotifyStatModifierSet
{
protected abstract IList> GetModifiersList();
@@ -119,4 +119,4 @@ private void NotifyChanged(StatModifierSetActionType action, IStatModifier
});
}
}
-}
\ No newline at end of file
+}
diff --git a/Runtime/BaseStatModifierMutableSet.cs.meta b/Runtime/BaseStatModifierSet.cs.meta
similarity index 100%
rename from Runtime/BaseStatModifierMutableSet.cs.meta
rename to Runtime/BaseStatModifierSet.cs.meta
diff --git a/Runtime/INotifyStatModifierSet.cs b/Runtime/INotifyStatModifierSet.cs
index 6f6b447..578b55a 100644
--- a/Runtime/INotifyStatModifierSet.cs
+++ b/Runtime/INotifyStatModifierSet.cs
@@ -13,13 +13,13 @@ public struct StatModifierSetChangedArgs
public IStatModifier Previous;
}
- public delegate void StatModifierSetChangedEventHandler(IStatModifierSet modifierSet, StatModifierSetChangedArgs args);
+ public delegate void StatModifierSetChangedEventHandler(IReadOnlyStatModifierSet modifierSet, StatModifierSetChangedArgs args);
///
/// Interface for a mutable set of stat modifiers that provides an event callback to notify when modifiers change
///
///
- public interface INotifyStatModifierSet : IStatModifierMutableSet
+ public interface INotifyStatModifierSet : IStatModifierSet
{
event StatModifierSetChangedEventHandler ModifiersChanged;
}
diff --git a/Runtime/IReadOnlyStatModifierSet.cs b/Runtime/IReadOnlyStatModifierSet.cs
new file mode 100644
index 0000000..b799783
--- /dev/null
+++ b/Runtime/IReadOnlyStatModifierSet.cs
@@ -0,0 +1,16 @@
+using System.Collections.Generic;
+
+namespace Gameframe.StatSheet
+{
+ ///
+ /// Enumerable Set of stat modifiers
+ /// Generic version
+ ///
+ /// Stat key type (Usually an enum)
+ public interface IReadOnlyStatModifierSet : IEnumerable>
+ {
+ IStatModifier Get(TKey statName, StatMode mode);
+
+ IEnumerable> Get(StatMode mode);
+ }
+}
diff --git a/Runtime/IReadOnlyStatModifierSet.cs.meta b/Runtime/IReadOnlyStatModifierSet.cs.meta
new file mode 100644
index 0000000..ba3bc66
--- /dev/null
+++ b/Runtime/IReadOnlyStatModifierSet.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 547c6c207c4f4555b824ed83cbffe66e
+timeCreated: 1662027998
\ No newline at end of file
diff --git a/Runtime/IStatModifierMutableSet.cs b/Runtime/IStatModifierMutableSet.cs
deleted file mode 100644
index 81f6707..0000000
--- a/Runtime/IStatModifierMutableSet.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace Gameframe.StatSheet
-{
- ///
- /// Enumerable set of stat modifiers
- /// Mutable version
- ///
- ///
- public interface IStatModifierMutableSet : IStatModifierSet
- {
- void Set(IStatModifier modifier);
- void Set(TKey statType, float value, StatMode mode);
- }
-}
\ No newline at end of file
diff --git a/Runtime/IStatModifierMutableSet.cs.meta b/Runtime/IStatModifierMutableSet.cs.meta
deleted file mode 100644
index 8c7beb5..0000000
--- a/Runtime/IStatModifierMutableSet.cs.meta
+++ /dev/null
@@ -1,3 +0,0 @@
-fileFormatVersion: 2
-guid: 9b4b4381bb014c09a320797c44c3e57c
-timeCreated: 1675198172
\ No newline at end of file
diff --git a/Runtime/IStatModifierSet.cs b/Runtime/IStatModifierSet.cs
index 8d0c75e..b771a7f 100644
--- a/Runtime/IStatModifierSet.cs
+++ b/Runtime/IStatModifierSet.cs
@@ -1,16 +1,13 @@
-using System.Collections.Generic;
-
namespace Gameframe.StatSheet
{
///
- /// Enumerable Set of stat modifiers
- /// Generic version
+ /// Enumerable set of stat modifiers
+ /// Mutable version
///
- /// Stat key type (Usually an enum)
- public interface IStatModifierSet : IEnumerable>
+ ///
+ public interface IStatModifierSet : IReadOnlyStatModifierSet
{
- IStatModifier Get(TKey statName, StatMode mode);
-
- IEnumerable> Get(StatMode mode);
+ void Set(IStatModifier modifier);
+ void Set(TKey statType, float value, StatMode mode);
}
}
diff --git a/Runtime/IStatModifierSet.cs.meta b/Runtime/IStatModifierSet.cs.meta
index ba3bc66..8c7beb5 100644
--- a/Runtime/IStatModifierSet.cs.meta
+++ b/Runtime/IStatModifierSet.cs.meta
@@ -1,3 +1,3 @@
fileFormatVersion: 2
-guid: 547c6c207c4f4555b824ed83cbffe66e
-timeCreated: 1662027998
\ No newline at end of file
+guid: 9b4b4381bb014c09a320797c44c3e57c
+timeCreated: 1675198172
\ No newline at end of file
diff --git a/Runtime/IStatModifierSetIndexed.cs b/Runtime/IStatModifierSetIndexed.cs
index 38e75a1..fa71680 100644
--- a/Runtime/IStatModifierSetIndexed.cs
+++ b/Runtime/IStatModifierSetIndexed.cs
@@ -4,7 +4,7 @@ namespace Gameframe.StatSheet
/// Indexed set of stat modifiers for easy index enumeration
///
/// Stat key type (Usually an enum)
- public interface IStatModifierSetIndexed : IStatModifierSet
+ public interface IStatModifierSetIndexed : IReadOnlyStatModifierSet
{
int Count { get; }
StatModifier GetIndex(int index);
diff --git a/Runtime/StatModel.cs b/Runtime/StatModel.cs
index 112cc61..9852ffb 100644
--- a/Runtime/StatModel.cs
+++ b/Runtime/StatModel.cs
@@ -46,9 +46,9 @@ private set
protected ListStatSet _statTotals = new ListStatSet();
public IStatSet StatTotals => _statTotals;
- protected List> _modifiers = new List>();
+ protected List> _modifiers = new List>();
- public virtual void AddModifierSet(IStatModifierSet modifierSet)
+ public virtual void AddModifierSet(IReadOnlyStatModifierSet modifierSet)
{
_modifiers.Add(modifierSet);
//If this modifier set is a notify set then subscribe for changes
@@ -56,22 +56,20 @@ public virtual void AddModifierSet(IStatModifierSet modifierSet)
{
notifySet.ModifiersChanged += NotifySetOnModifiersChanged;
}
-
IsDirty = true;
}
- public virtual void RemoveModifier(IStatModifierSet modifierSet)
+ public virtual void RemoveModifier(IReadOnlyStatModifierSet modifierSet)
{
_modifiers.Remove(modifierSet);
if (modifierSet is INotifyStatModifierSet notifySet)
{
notifySet.ModifiersChanged -= NotifySetOnModifiersChanged;
}
-
IsDirty = true;
}
- public void ClearModifiers()
+ public virtual void ClearModifiers()
{
foreach (var modifierSet in _modifiers)
{
@@ -84,7 +82,7 @@ public void ClearModifiers()
IsDirty = true;
}
- private void NotifySetOnModifiersChanged(IStatModifierSet set, StatModifierSetChangedArgs args)
+ private void NotifySetOnModifiersChanged(IReadOnlyStatModifierSet set, StatModifierSetChangedArgs args)
{
IsDirty = true;
}
diff --git a/Runtime/StatModifierSet.cs b/Runtime/StatModifierSet.cs
index 6fc964f..84f3993 100644
--- a/Runtime/StatModifierSet.cs
+++ b/Runtime/StatModifierSet.cs
@@ -6,7 +6,7 @@ namespace Gameframe.StatSheet
/// Mutable set of stat modifiers
///
/// Stat key type
- public class StatModifierSet : BaseStatModifierMutableSet
+ public class StatModifierSet : BaseStatModifierSet
{
private List> _mods = new List>();