1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Sirenix.OdinInspector;
- namespace KairoEngine.Utilities.Statistics
- {
- public enum StatisticType
- {
- time,
- integer,
- text
- }
- [System.Serializable, HideMonoScript]
- public class StatisticData
- {
- [HorizontalGroup(180), HideLabel] public string title;
- [ShowIf("@category == StatisticType.time"), HorizontalGroup(), HideLabel, ShowInInspector] private float time;
- [ShowIf("@category == StatisticType.integer"), HorizontalGroup(), HideLabel, ShowInInspector] private int integer;
- [ShowIf("@category == StatisticType.text"), HorizontalGroup(), HideLabel, ShowInInspector] private string text;
- [HorizontalGroup(80), HideLabel] public StatisticType category;
- [HorizontalGroup(), HideLabel, Tooltip("Persistent Data?")] public bool persistent = false;
- public void AddTime(float t) => time += t;
- public void AddInteger(int n) => integer += n;
- public float GetTime() => time;
- public int GetInteger() => integer;
- 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 Reset()
- {
- time = 0f;
- integer = 0;
- text = "";
- }
- }
- }
|