mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-04 20:45:54 +00:00
Possession handling
This commit is contained in:
parent
681510d75c
commit
31ffe6156e
9 changed files with 305 additions and 22 deletions
42
Scripts/Resources/Events/ControlActorEvent.cs
Normal file
42
Scripts/Resources/Events/ControlActorEvent.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Resources.Events;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class ControlActorEvent : EventResource
|
||||
{
|
||||
[Export]
|
||||
public NodePath Target { get; set; }
|
||||
|
||||
private Node2D _parent;
|
||||
|
||||
private GameManager _gameManager;
|
||||
private bool _isComplete = false;
|
||||
public override bool IsComplete()
|
||||
{
|
||||
return _isComplete;
|
||||
}
|
||||
|
||||
public override void Init(Node2D parent)
|
||||
{
|
||||
_gameManager = parent.GetGameManager();
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public override void Start(Node2D parentNode)
|
||||
{
|
||||
_isComplete = false;
|
||||
|
||||
if (_parent.GetNode<Node2D>(Target) is Actor enemy)
|
||||
{
|
||||
if (GameManager.Instance.ToggleControlMode() is GameState.Controlling)
|
||||
{
|
||||
enemy.AssumeControl();
|
||||
}
|
||||
}
|
||||
|
||||
_isComplete = true;
|
||||
}
|
||||
|
||||
public override void UpdateEvent(double delta) { }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue