Add SkillManager class and integrate with PlayerController and SkillUnlockerComponent (#10)
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Godot;
|
||||
using Mr.BrickAdventures.Autoloads;
|
||||
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
@@ -31,6 +32,9 @@ public partial class PlayerController : CharacterBody2D
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
var skillManager = GetNodeOrNull<SkillManager>("/root/SkillManager");
|
||||
skillManager?.RegisterPlayer(this);
|
||||
|
||||
_inputHandler = GetNode<PlayerInputHandler>("PlayerInputHandler");
|
||||
foreach (var child in MovementAbilitiesContainer.GetChildren())
|
||||
{
|
||||
|
@@ -8,7 +8,7 @@ namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
public partial class SkillUnlockerComponent : Node
|
||||
{
|
||||
[Export] public SkillManager SkillManager { get; set; }
|
||||
public SkillManager SkillManager { get; private set; }
|
||||
|
||||
[Signal]
|
||||
public delegate void SkillUnlockedEventHandler(SkillData skill);
|
||||
@@ -18,6 +18,7 @@ public partial class SkillUnlockerComponent : Node
|
||||
public override void _Ready()
|
||||
{
|
||||
_gameManager = GetNode<GameManager>("/root/GameManager");
|
||||
SkillManager = GetNode<SkillManager>("/root/SkillManager");
|
||||
}
|
||||
|
||||
private bool HasEnoughCoins(int amount)
|
||||
|
Reference in New Issue
Block a user