using System; using Cirno.Scripts.Utils; using Godot; using Godot.Collections; namespace Cirno.Scripts.Actors._3D; [Tool] public partial class SecurityCamera3D : Destructible3D { [Export] public StringName SweepAnimation { get; private set; } = "SweepLoop"; [Export] public string TargetGroup { get; private set; } [Export] public ActivationType ActivationType { get; set; } = ActivationType.Toggle; [Signal] public delegate void AnimationStartEventHandler(string animationName); [Signal] public delegate void OnActivatedEventHandler(ActivationType activationType); public void _func_godot_apply_properties(Dictionary props) { TargetGroup = props["target"]; if (props.TryGetValue("activationtype", out var type)) { var t = Enum.TryParse(type, true, out ActivationType activationType); if (t) { ActivationType = activationType; } } } public override void _Ready() { if (Engine.IsEditorHint()) return; EmitSignalAnimationStart(SweepAnimation); } public void OnBodySighted(Node3D body) { if (Engine.IsEditorHint()) return; GD.Print($"{body.Name} Sighted!"); AlarmManager.Instance?.SoundAlarm(this.GlobalPosition); if (!string.IsNullOrWhiteSpace(TargetGroup)) { ActivationHelper.UseTargets(this, TargetGroup); } } }