blob: d3c4aa3f1035e042d295a922f88f3e7b8a8fca99 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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}
};
}
}
|