Skip to content

Commit e469d21

Browse files
author
krzysztof biernat
committed
Remove onChangedValue event from variable
1 parent ba41cac commit e469d21

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

Runtime/Variables/Variable.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff 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;

Runtime/Variables/Vars/IntVariable.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)