|
@@ -2,6 +2,7 @@
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine;
|
|
using Sirenix.OdinInspector;
|
|
using Sirenix.OdinInspector;
|
|
|
|
+using KairoEngine.Core;
|
|
|
|
|
|
namespace KairoEngine.Utilities.Statistics
|
|
namespace KairoEngine.Utilities.Statistics
|
|
{
|
|
{
|
|
@@ -23,18 +24,39 @@ namespace KairoEngine.Utilities.Statistics
|
|
[HorizontalGroup(80), HideLabel] public StatisticType category;
|
|
[HorizontalGroup(80), HideLabel] public StatisticType category;
|
|
[HorizontalGroup(), HideLabel, Tooltip("Persistent Data?")] public bool persistent = false;
|
|
[HorizontalGroup(), HideLabel, Tooltip("Persistent Data?")] public bool persistent = false;
|
|
|
|
|
|
- public void AddTime(float t) => time += t;
|
|
|
|
- public void AddInteger(int n) => integer += n;
|
|
|
|
|
|
+ public void AddTime(float t)
|
|
|
|
+ {
|
|
|
|
+ time += t;
|
|
|
|
+ TriggerEvent(time);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void AddInteger(int n)
|
|
|
|
+ {
|
|
|
|
+ integer += n;
|
|
|
|
+ TriggerEvent(integer);
|
|
|
|
+ }
|
|
|
|
|
|
public float GetTime() => time;
|
|
public float GetTime() => time;
|
|
public int GetInteger() => integer;
|
|
public int GetInteger() => integer;
|
|
public string GetText() => text;
|
|
public string GetText() => text;
|
|
|
|
|
|
- public void SetTime(float t) => time = t;
|
|
|
|
- public void SetInteger(int n) => integer = n;
|
|
|
|
- public void SetText(string t) => text = t;
|
|
|
|
|
|
+ public void SetTime(float t)
|
|
|
|
+ {
|
|
|
|
+ time = t;
|
|
|
|
+ TriggerEvent(time);
|
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
|
|
|
+ public void SetInteger(int n)
|
|
|
|
+ {
|
|
|
|
+ integer = n;
|
|
|
|
+ TriggerEvent(integer);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void SetText(string t)
|
|
|
|
+ {
|
|
|
|
+ text = t;
|
|
|
|
+ TriggerEvent(text);
|
|
|
|
+ }
|
|
|
|
|
|
public void Reset()
|
|
public void Reset()
|
|
{
|
|
{
|
|
@@ -43,5 +65,11 @@ namespace KairoEngine.Utilities.Statistics
|
|
text = "";
|
|
text = "";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void TriggerEvent(float time) => GenericEvents.Trigger("StatisticDataChanged", title, time);
|
|
|
|
+
|
|
|
|
+ private void TriggerEvent(int integer) => GenericEvents.Trigger("StatisticDataChanged", title, integer);
|
|
|
|
+
|
|
|
|
+ private void TriggerEvent(string text) => GenericEvents.Trigger("StatisticDataChanged", title, text);
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|