diff options
| author | Gustavoeklund01 <eklundgu@gmail.com> | 2025-11-10 17:25:59 -0300 |
|---|---|---|
| committer | Gustavoeklund01 <eklundgu@gmail.com> | 2025-11-10 17:25:59 -0300 |
| commit | 1a042d7303081e8bc72e9e3c341db3e528c8d998 (patch) | |
| tree | cb56eafbd73ab8c7f8ba231fd512ae246b4dd64b /scripts/Utils | |
| parent | de99779d19b77d174c561cb3795538412f53bcbc (diff) | |
| parent | f46d058571d453ccf7ddf884ccb5d8694f970d7c (diff) | |
Diffstat (limited to 'scripts/Utils')
| -rw-r--r-- | scripts/Utils/Stats.cs | 52 | ||||
| -rw-r--r-- | scripts/Utils/Stats.cs.uid | 1 |
2 files changed, 53 insertions, 0 deletions
diff --git a/scripts/Utils/Stats.cs b/scripts/Utils/Stats.cs new file mode 100644 index 0000000..d3c4aa3 --- /dev/null +++ b/scripts/Utils/Stats.cs @@ -0,0 +1,52 @@ +using Godot; +using Godot.Collections; +using TheLegendOfGustav.Utils; + +namespace TheLegendOfGustav.Utils; + +public partial class Stats : Node +{ + public static Stats Instance { get; set; } + + public string PlayerName { get; set; } + public int MaxFloor { get; set; } = 0; + + public int EnemiesKilled { get; set; } = 0; + + public int DamageTaken { get; set; } = 0; + + public override void _Ready() + { + base._Ready(); + Instance = this; + + SignalBus.Instance.DungeonFloorChanged += OnFloorChange; + } + + public void Clear() + { + PlayerName = ""; + MaxFloor = 0; + EnemiesKilled = 0; + DamageTaken = 0; + } + + void OnFloorChange(int floor) + { + if (floor > MaxFloor) + { + MaxFloor = floor; + } + } + + public Dictionary<string, Variant> Serialize() + { + return new() + { + {"jogador", PlayerName}, + {"andar_mais_fundo", MaxFloor}, + {"inimigos_mortos", EnemiesKilled}, + {"dano_tomado", DamageTaken} + }; + } +}
\ No newline at end of file diff --git a/scripts/Utils/Stats.cs.uid b/scripts/Utils/Stats.cs.uid new file mode 100644 index 0000000..a93778d --- /dev/null +++ b/scripts/Utils/Stats.cs.uid @@ -0,0 +1 @@ +uid://eg7t08o6wpxb |
