Spinning chairs

This commit is contained in:
Marco 2025-03-10 15:49:28 +01:00
commit 72ce9fb932
16 changed files with 290 additions and 24 deletions

34
Scripts/Activables/NPC.cs Normal file
View file

@ -0,0 +1,34 @@
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;
}
}

View file

@ -0,0 +1 @@
uid://cjy38nsh83ug1

View file

@ -8,7 +8,7 @@ namespace Cirno.Scripts.Activables;
public partial class ScriptableBase : Node2D, IActivable
{
[Export] public Array<EventResource> Events;
[Export] public Array<EventResource> Events { get; set; } = [];
private EventResource CurrentEvent => Events[_currentEventIndex];