using UnityEngine; using UnityEngine.Events; public class ScoreController : CoreBehaviour { public enum ScoreType { DEFAULT_SCORE = 0 } public class ScoreEvent : UnityEvent { } [HideInInspector] public ScoreEvent onScore = new ScoreEvent(); public long Score { get; private set; } public int multCurrency { get; private set; } public void Setup() { Score = 0L; } public void InitScore(long score) { Score = score; } public void UpdateScore(long score, Transform obj, ScoreType type) { long delta = score - Score; if (delta != 0L) { Score = score; onScore.Invoke((int)delta, obj, type); } } public void IncScore(long inc, Transform obj, ScoreType type) { Score += inc; onScore.Invoke((int)inc, obj, type); } public void SetMultCurrency(int mult) { multCurrency = mult; Score *= mult; } public void Reset() { Score = 0L; } }