File tree Expand file tree Collapse file tree 2 files changed +5
-20
lines changed
Expand file tree Collapse file tree 2 files changed +5
-20
lines changed Original file line number Diff line number Diff line change @@ -12,25 +12,18 @@ namespace GTVariable
1212 public class Variable < T > : ScriptableObject
1313 {
1414 public T value ;
15- public UnityEvent onValueChange ;
1615
1716
1817 public T GetValue ( )
1918 {
2019 return value ;
2120 }
2221
23- public void SetValue ( T value )
22+ public virtual void SetValue ( T value )
2423 {
2524 this . value = value ;
2625 }
2726
28- public void SetValueWithEvent ( T value )
29- {
30- this . value = value ;
31- onValueChange ? . Invoke ( ) ;
32- }
33-
3427 public static implicit operator T ( Variable < T > genericVariable )
3528 {
3629 return genericVariable . value ;
Original file line number Diff line number Diff line change @@ -13,22 +13,14 @@ private void OnEnable()
1313 }
1414 }
1515
16- public void Increament ( bool sendChanageEvent = false )
16+ public void Increament ( )
1717 {
18- value ++ ;
19- if ( sendChanageEvent )
20- {
21- onValueChange ? . Invoke ( ) ;
22- }
18+ SetValue ( value + 1 ) ;
2319 }
2420
25- public void Decreament ( bool sendChanageEvent = false )
21+ public void Decreament ( )
2622 {
27- value -- ;
28- if ( sendChanageEvent )
29- {
30- onValueChange ? . Invoke ( ) ;
31- }
23+ SetValue ( value - 1 ) ;
3224 }
3325
3426 }
You can’t perform that action at this time.
0 commit comments