refactor party

This commit is contained in:
2026-08-12 13:31:11 +02:00
parent 81d7a213cd
commit 51da5c97eb
29 changed files with 274 additions and 67 deletions

87
Ceo.cs Normal file
View File

@@ -0,0 +1,87 @@
using Godot;
namespace Game;
[GlobalClass]
public partial class Ceo : Resource
{
private float _competence = 50;
private float _energy = 100;
private float _insanity;
private float _maxEnergy = 100;
private string _name = "";
[Export]
public string Name
{
get => _name;
set
{
_name = value;
EmitCeoStatusChanged();
}
}
[Export]
public float Energy
{
get => _energy;
set
{
_energy = Mathf.Clamp(value, 0, MaxEnergy);
EmitCeoStatusChanged();
}
}
[Export]
public float MaxEnergy
{
get => _maxEnergy;
set
{
_maxEnergy = Mathf.Max(value, 0);
_energy = Mathf.Min(_energy, _maxEnergy);
EmitCeoStatusChanged();
}
}
[Export]
public float Insanity
{
get => _insanity;
set
{
_insanity = value;
EmitCeoStatusChanged();
}
}
[Export]
public float Competence
{
get => _competence;
set
{
_competence = value;
EmitCeoStatusChanged();
}
}
private void EmitCeoStatusChanged()
{
EventBus.CeoChanged.Invoke(ToCeoStats());
}
public CeoStats ToCeoStats()
{
return new CeoStats(Name, Energy, MaxEnergy, Insanity, Competence);
}
public record CeoStats(
string Name,
float Energy,
float MaxEnergy,
float Insanity,
float Competence
);
}