Chest animation, alarm box entity

This commit is contained in:
Marco 2025-06-24 15:00:27 +02:00
commit 164c186201
25 changed files with 177 additions and 23 deletions

View file

@ -7,7 +7,7 @@ using Godot.Collections;
namespace Cirno.Scripts.Activables;
[Tool]
public partial class Terminal3D : Area3D, IInteractable
public partial class DialogueActor3D : Area3D, IInteractable
{
[Export] public StringName TimelineName = "";
private DialogueTools _dialogueInstance;

View file

@ -11,6 +11,9 @@ public partial class Chest3D : Interactable3D
[Export] public ChestState State = ChestState.Closed;
[Signal] public delegate void OpenChestEventHandler();
[Signal] public delegate void CloseChestEventHandler();
public override bool Activate(ActivationType activationType = ActivationType.Toggle)
{
GD.Print("Attempting to open chest");
@ -21,6 +24,7 @@ public partial class Chest3D : Interactable3D
InventoryManager.Instance.AddItem(item);
}
EmitSignalOpenChest();
//_sprite.Play("Opening");
State = ChestState.Open;

View file

@ -0,0 +1,8 @@
using Godot;
namespace Cirno.Scripts.Components.Actors._3D;
public partial class ModelAnimation3D : Node
{
}

View file

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

View file

@ -0,0 +1,42 @@
using Godot;
namespace Cirno.Scripts.Interactables;
[Tool]
public partial class AlarmBox3D : Interactable3D
{
private AudioStreamPlayer _activationSound;
private readonly string _activationSoundName = "ActivationSound";
[Signal] public delegate void OnActivatedEventHandler(ActivationType activationType);
public override void _Ready()
{
if (Engine.IsEditorHint()) return;
_activationSound = GetNodeOrNull<AudioStreamPlayer>(_activationSoundName);
if (AlarmManager.Instance is not null)
{
AlarmManager.Instance.AlarmEnabled3D += OnAlarmEnabled3D;
}
}
private void OnAlarmEnabled3D(Vector3 location)
{
// TODO: set animation, make blinky
GD.Print($"Enabled alarm in box {this.Name}");
}
public override bool Activate(ActivationType activationType = ActivationType.Toggle)
{
EmitSignal(SignalName.OnActivated, (int)activationType);
if (AlarmManager.Instance is not null)
{
_activationSound.Play();
AlarmManager.Instance.DisableAlarm();
}
return true;
}
}

View file

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