mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-12 21:25:53 +00:00
3D Cameras with sweep and animation
This commit is contained in:
parent
4cc7a0c004
commit
7e76edc153
48 changed files with 3211 additions and 1511 deletions
27
Scripts/Actors/3D/AlarmSoundPlayer3D.cs
Normal file
27
Scripts/Actors/3D/AlarmSoundPlayer3D.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Actors._3D;
|
||||
|
||||
public partial class AlarmSoundPlayer3D : AudioStreamPlayer3D
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
if (AlarmManager.Instance is not null)
|
||||
{
|
||||
this.Stream = AlarmManager.Instance.AlarmSound;
|
||||
|
||||
AlarmManager.Instance.AlarmEnabled3D += InstanceOnAlarmEnabled3D;
|
||||
AlarmManager.Instance.AlarmDisabled += InstanceOnAlarmDisabled;
|
||||
}
|
||||
}
|
||||
|
||||
private void InstanceOnAlarmDisabled()
|
||||
{
|
||||
this.Stop();
|
||||
}
|
||||
|
||||
private void InstanceOnAlarmEnabled3D(Vector3 location)
|
||||
{
|
||||
this.Play();
|
||||
}
|
||||
}
|
||||
1
Scripts/Actors/3D/AlarmSoundPlayer3D.cs.uid
Normal file
1
Scripts/Actors/3D/AlarmSoundPlayer3D.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://0g2sdu48c2x8
|
||||
24
Scripts/Actors/3D/SecurityCamera3D.cs
Normal file
24
Scripts/Actors/3D/SecurityCamera3D.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Actors._3D;
|
||||
|
||||
public partial class SecurityCamera3D : Destructible3D
|
||||
{
|
||||
[Export] public StringName SweepAnimation { get; private set; } = "SweepLoop";
|
||||
|
||||
[Signal]
|
||||
public delegate void AnimationStartEventHandler(string animationName);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
1
Scripts/Actors/3D/SecurityCamera3D.cs.uid
Normal file
1
Scripts/Actors/3D/SecurityCamera3D.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dg3aho2ulfngs
|
||||
Loading…
Add table
Add a link
Reference in a new issue