basic Party Manager
This commit is contained in:
parent
c141e6a169
commit
6f1d5ea681
10 changed files with 158 additions and 8 deletions
|
|
@ -5,6 +5,8 @@ public partial class CaptureUI : CanvasLayer
|
|||
[Export] public float BaseTimeLimit = 3.0f;
|
||||
[Export] public float BaseRequired = 14.0f; // “energy” required
|
||||
[Export] public float EnergyPerPress = 1.0f;
|
||||
[Export] public NodePath PartyManagerPath { get; set; }
|
||||
private PartyManager? _party;
|
||||
|
||||
private Creature? _target;
|
||||
private SaveManager? _save;
|
||||
|
|
@ -32,7 +34,8 @@ public partial class CaptureUI : CanvasLayer
|
|||
_ballOption.AddItem("Basic Soulball (easy)", 0);
|
||||
_ballOption.AddItem("Heavy Soulball (hard)", 1);
|
||||
|
||||
_save = GetNodeOrNull<SaveManager>("/root/Main/SaveManager"); // or export a path if you prefer
|
||||
_party = GetNodeOrNull<PartyManager>(PartyManagerPath);
|
||||
if (_party == null) GD.PrintErr("CaptureUI: PartyManagerPath not set.");
|
||||
}
|
||||
|
||||
public void StartCapture(Creature target)
|
||||
|
|
@ -102,13 +105,7 @@ public partial class CaptureUI : CanvasLayer
|
|||
|
||||
GD.Print($"Captured {_target.CreatureId}");
|
||||
|
||||
// v0: store captured creature IDs
|
||||
if (_save != null)
|
||||
{
|
||||
_save.State.CapturedCreatures.Add(_target.CreatureId);
|
||||
_save.Save();
|
||||
}
|
||||
|
||||
_party?.AddToParty(_target.CreatureId);
|
||||
_target.Despawn();
|
||||
EndCapture();
|
||||
}
|
||||
|
|
|
|||
22
scripts/ui/PartyHUD.cs
Normal file
22
scripts/ui/PartyHUD.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using Godot;
|
||||
using System.Linq;
|
||||
|
||||
public partial class PartyHUD : CanvasLayer
|
||||
{
|
||||
[Export] public NodePath PartyManagerPath { get; set; }
|
||||
private PartyManager? _party;
|
||||
private Label _label = null!;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_label = GetNode<Label>("PartyLabel");
|
||||
_party = GetNodeOrNull<PartyManager>(PartyManagerPath);
|
||||
if (_party == null) GD.PrintErr("PartyHUD: PartyManagerPath not set.");
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (_party == null) return;
|
||||
_label.Text = "Party: " + string.Join(", ", _party.PartyCreatureIds.Take(6));
|
||||
}
|
||||
}
|
||||
1
scripts/ui/PartyHUD.cs.uid
Normal file
1
scripts/ui/PartyHUD.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://lonokky58akh
|
||||
Loading…
Add table
Add a link
Reference in a new issue