summaryrefslogtreecommitdiff
path: root/scripts/Utils/Stats.cs
diff options
context:
space:
mode:
authorGustavoeklund01 <eklundgu@gmail.com>2025-11-10 17:25:59 -0300
committerGustavoeklund01 <eklundgu@gmail.com>2025-11-10 17:25:59 -0300
commit1a042d7303081e8bc72e9e3c341db3e528c8d998 (patch)
treecb56eafbd73ab8c7f8ba231fd512ae246b4dd64b /scripts/Utils/Stats.cs
parentde99779d19b77d174c561cb3795538412f53bcbc (diff)
parentf46d058571d453ccf7ddf884ccb5d8694f970d7c (diff)
Merge branch 'master' of https://github.com/Simplesmente-O-Grupo/projeto-fantasiaHEADmaster
Diffstat (limited to 'scripts/Utils/Stats.cs')
-rw-r--r--scripts/Utils/Stats.cs52
1 files changed, 52 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