Refactor Player class to use components, also use components in Enemy class types and fiddle with boss structure

This commit is contained in:
2025-10-22 02:41:08 -07:00
parent 44fd8c82b0
commit 6ec45c4805
85 changed files with 941 additions and 1449 deletions

View File

@@ -37,15 +37,15 @@ public partial class PlayerInfoUI : Control, IPlayerInfoUI
public void Activate()
{
Player.Stats.CurrentHP.Sync += CurrentHP_Sync;
Player.Stats.MaximumHP.Sync += MaximumHP_Sync;
Player.HealthComponent.CurrentHP.Sync += HPSync;
Player.HealthComponent.MaximumHP.Sync += HPSync;
Player.Stats.CurrentVT.Sync += CurrentVT_Sync;
Player.Stats.MaximumVT.Sync += MaximumVT_Sync;
Player.VTComponent.CurrentVT.Sync += VTSync;
Player.VTComponent.MaximumVT.Sync += VTSync;
Player.Stats.CurrentLevel.Sync += CurrentLevel_Sync;
Player.Stats.CurrentExp.Sync += CurrentExp_Sync;
Player.Stats.ExpToNextLevel.Sync += ExpToNextLevel_Sync;
Player.ExperiencePointsComponent.Level.Sync += CurrentLevel_Sync;
Player.ExperiencePointsComponent.CurrentExp.Sync += ExpSync;
Player.ExperiencePointsComponent.ExpToNextLevel.Sync += ExpSync;
}
private void CurrentLevel_Sync(int obj)
@@ -53,36 +53,22 @@ public partial class PlayerInfoUI : Control, IPlayerInfoUI
LevelNumber.Text = $"{obj}";
}
private void MaximumVT_Sync(int obj)
private void VTSync(int obj)
{
VTNumber.Text = $"{Player.Stats.CurrentVT.Value}/{obj}";
VTProgressBar.MaxValue = obj;
VTNumber.Text = $"{Player.VTComponent.CurrentVT.Value}/{Player.VTComponent.MaximumVT.Value}";
VTProgressBar.Value = Player.VTComponent.CurrentVT.Value;
VTProgressBar.MaxValue = Player.VTComponent.MaximumVT.Value;
}
private void CurrentVT_Sync(int obj)
private void HPSync(int obj)
{
VTNumber.Text = $"{obj}/{Player.Stats.MaximumVT.Value}";
VTProgressBar.Value = obj;
HPNumber.Text = $"{Player.HealthComponent.CurrentHP.Value}/{Player.HealthComponent.MaximumHP.Value}";
HPProgressBar.Value = Player.HealthComponent.CurrentHP.Value;
HPProgressBar.MaxValue = Player.HealthComponent.MaximumHP.Value;
}
private void MaximumHP_Sync(int obj)
private void ExpSync(int obj)
{
HPNumber.Text = $"{Player.Stats.CurrentHP.Value}/{obj}";
HPProgressBar.MaxValue = obj;
}
private void CurrentHP_Sync(int obj)
{
HPNumber.Text = $"{obj}/{Player.Stats.MaximumHP.Value}";
HPProgressBar.Value = obj;
}
private void CurrentExp_Sync(double obj)
{
EXPNumber.Text = $"{(int)obj}/{Player.Stats.ExpToNextLevel.Value}";
}
private void ExpToNextLevel_Sync(int obj)
{
EXPNumber.Text = $"{Player.Stats.CurrentExp.Value}/{obj}";
EXPNumber.Text = $"{Player.ExperiencePointsComponent.CurrentExp.Value}/{Player.ExperiencePointsComponent.ExpToNextLevel.Value}";
}
}