refactor: Replace hardcoded node paths with constants and remove ScoreComponent.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Godot;
|
||||
using Mr.BrickAdventures;
|
||||
using Mr.BrickAdventures.Autoloads;
|
||||
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
@@ -10,12 +11,12 @@ public partial class PlayerDeathComponent : Node2D
|
||||
[Export] public PackedScene DeathEffect { get; set; }
|
||||
[Export] public HealthComponent HealthComponent { get; set; }
|
||||
[Export] public Vector2 EffectScale { get; set; } = new Vector2(1.5f, 1.5f);
|
||||
|
||||
|
||||
private GameManager _gameManager;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
||||
_gameManager = GetNode<GameManager>(Constants.GameManagerPath);
|
||||
HealthComponent.Death += OnDeath;
|
||||
}
|
||||
|
||||
@@ -30,7 +31,7 @@ public partial class PlayerDeathComponent : Node2D
|
||||
effect.GlobalPosition = GlobalPosition;
|
||||
effect.Scale = EffectScale;
|
||||
}
|
||||
|
||||
|
||||
_gameManager.RemoveLives(1);
|
||||
_gameManager.ResetCurrentSessionState();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user