refactor: Replace hardcoded node paths with constants and remove ScoreComponent.

This commit is contained in:
2026-01-31 15:35:04 +01:00
parent 62bdf1ba39
commit b62478bbea
27 changed files with 183 additions and 202 deletions

View File

@@ -1,4 +1,5 @@
using Godot;
using Mr.BrickAdventures;
using Mr.BrickAdventures.Autoloads;
using Mr.BrickAdventures.scripts.interfaces;
using Mr.BrickAdventures.scripts.Resources;
@@ -9,7 +10,7 @@ namespace Mr.BrickAdventures.scripts.components;
public partial class BrickShieldSkillComponent : Node, ISkill
{
[Export] public PackedScene ShieldScene { get; set; }
private PlayerController _player;
private Node2D _shieldInstance;
private SkillData _skillData;
@@ -19,8 +20,8 @@ public partial class BrickShieldSkillComponent : Node, ISkill
public override void _Ready()
{
_gameManager = GetNode<GameManager>("/root/GameManager");
_skillManager = GetNode<SkillManager>("/root/SkillManager");
_gameManager = GetNode<GameManager>(Constants.GameManagerPath);
_skillManager = GetNode<SkillManager>(Constants.SkillManagerPath);
}
public void Initialize(Node owner, SkillData data)
@@ -59,7 +60,7 @@ public partial class BrickShieldSkillComponent : Node, ISkill
_shieldHealth.MaxHealth = (float)newHealth;
}
}
private void OnShieldDestroyed()
{
if (_gameManager != null && _skillData != null && _skillManager != null)