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(_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; } }