mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
42 lines
No EOL
927 B
C#
42 lines
No EOL
927 B
C#
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) { }
|
|
} |