mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-04 18:56:03 +00:00
28 lines
709 B
C#
28 lines
709 B
C#
|
|
using Cirno.Scripts.Activables;
|
|||
|
|
using Godot;
|
|||
|
|
|
|||
|
|
namespace Cirno.Scripts.Actors;
|
|||
|
|
|
|||
|
|
public partial class AlarmTeleporterActorSpawner : ActorSpawner
|
|||
|
|
{
|
|||
|
|
private AlarmManager _alarmManager;
|
|||
|
|
|
|||
|
|
[Export]
|
|||
|
|
public Teleporter Teleporter { get; private set; }
|
|||
|
|
|
|||
|
|
[Export]
|
|||
|
|
public float ActivationRange { get; private set; }
|
|||
|
|
|
|||
|
|
public override void _Ready()
|
|||
|
|
{
|
|||
|
|
_alarmManager = this.GetAlarmManager();
|
|||
|
|
_alarmManager.AlarmEnabled += AlarmManagerOnAlarmEnabled;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void AlarmManagerOnAlarmEnabled(Vector2 location)
|
|||
|
|
{
|
|||
|
|
if (!(location.DistanceTo(this.GlobalPosition) <= ActivationRange)) return;
|
|||
|
|
Teleporter?.FireParticles();
|
|||
|
|
Spawn();
|
|||
|
|
}
|
|||
|
|
}
|