basic capture functionality
This commit is contained in:
parent
246f3c0840
commit
c141e6a169
20 changed files with 430 additions and 14 deletions
28
scripts/core/CaptureController.cs
Normal file
28
scripts/core/CaptureController.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using Godot;
|
||||
|
||||
public partial class CaptureController : Node
|
||||
{
|
||||
[Export] public NodePath CaptureUIPath { get; set; }
|
||||
|
||||
private GameRoot _root = null!;
|
||||
private CaptureUI? _ui;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_ui = GetNodeOrNull<CaptureUI>(CaptureUIPath);
|
||||
if (_ui == null)
|
||||
{
|
||||
GD.PrintErr("CaptureController: CaptureUIPath not set.");
|
||||
return;
|
||||
}
|
||||
|
||||
GameRoot.Instance.CaptureRequested += OnRequestCapture;
|
||||
}
|
||||
|
||||
private void OnRequestCapture(Creature creature)
|
||||
{
|
||||
if (_ui == null) return;
|
||||
if (!IsInstanceValid(creature)) return;
|
||||
_ui.StartCapture(creature);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue