Add skill upgrade system and refactor skill components for enhanced functionality; update resource paths and configurations

This commit is contained in:
2025-08-26 23:48:59 +02:00
parent afca70e6c6
commit 55c3ae212b
20 changed files with 212 additions and 76 deletions

View File

@@ -13,6 +13,7 @@ public partial class BrickThrowComponent : Node, ISkill
private bool _canThrow = true;
private Timer _timer;
private SkillData _skillData;
public override void _Ready()
{
@@ -81,13 +82,20 @@ public partial class BrickThrowComponent : Node, ISkill
_timer.Start();
}
public void Initialize(Node owner)
public void Initialize(Node owner, SkillData data)
{
PlayerController = owner as PlayerController;
_skillData = data;
if (PlayerController == null)
{
GD.PushError("BrickThrowComponent: Owner is not a PlayerController.");
}
if (_skillData.Level > 0 && _skillData.Upgrades.Count >= _skillData.Level)
{
ApplyUpgrade(_skillData.Upgrades[_skillData.Level - 1]);
}
}
public void Activate()
@@ -99,4 +107,12 @@ public partial class BrickThrowComponent : Node, ISkill
{
if (ThrowInputBehavior != null) ThrowInputBehavior.ThrowRequested -= ThrowBrick;
}
public void ApplyUpgrade(SkillUpgrade upgrade)
{
foreach (var property in upgrade.Properties)
{
Set(property.Key, property.Value);
}
}
}