mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-14 10:03:46 +00:00
Chest animation, alarm box entity
This commit is contained in:
parent
f28a3b70fd
commit
164c186201
25 changed files with 177 additions and 23 deletions
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
8
Scripts/Components/Actors/3D/ModelAnimation3D.cs
Normal file
8
Scripts/Components/Actors/3D/ModelAnimation3D.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.Actors._3D;
|
||||
|
||||
public partial class ModelAnimation3D : Node
|
||||
{
|
||||
|
||||
}
|
||||
1
Scripts/Components/Actors/3D/ModelAnimation3D.cs.uid
Normal file
1
Scripts/Components/Actors/3D/ModelAnimation3D.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dw1e13462567x
|
||||
42
Scripts/Interactables/AlarmBox3D.cs
Normal file
42
Scripts/Interactables/AlarmBox3D.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
1
Scripts/Interactables/AlarmBox3D.cs.uid
Normal file
1
Scripts/Interactables/AlarmBox3D.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dxhf1twoxf4j0
|
||||
Loading…
Add table
Add a link
Reference in a new issue