cirnogodot/Scripts/Activables/NPC.cs
2025-03-10 15:49:28 +01:00

34 lines
No EOL
719 B
C#

using Cirno.Scripts.Interactables;
using Cirno.Scripts.Resources.Events;
using Godot;
using Godot.Collections;
namespace Cirno.Scripts.Activables;
public partial class NPC : Area2D, IInteractable
{
[Export] public Array<EventResource> Events;
private ScriptableBase _scriptable;
public override void _Ready()
{
_scriptable = new ScriptableBase();
_scriptable.Events = Events;
this.CallDeferred("add_child", _scriptable);
}
public bool Activate(ActivationType activationType = ActivationType.Toggle)
{
_scriptable?.Activate(activationType);
return true;
}
public bool CanActivate()
{
return true;
}
}