mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-12 05:25:55 +00:00
Camera triggers
This commit is contained in:
parent
827d4f1914
commit
b0d0161ab0
8 changed files with 1136 additions and 1074 deletions
|
|
@ -1,14 +1,37 @@
|
|||
using Godot;
|
||||
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<string, string> 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;
|
||||
|
|
@ -20,5 +43,9 @@ public partial class SecurityCamera3D : Destructible3D
|
|||
if (Engine.IsEditorHint()) return;
|
||||
GD.Print($"{body.Name} Sighted!");
|
||||
AlarmManager.Instance?.SoundAlarm(this.GlobalPosition);
|
||||
if (!string.IsNullOrWhiteSpace(TargetGroup))
|
||||
{
|
||||
ActivationHelper.UseTargets(this, TargetGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue