Teleport spawner tweaks

This commit is contained in:
MaddoScientisto 2025-03-10 22:37:42 +01:00
commit 2ba95ee922
5 changed files with 53 additions and 16 deletions

View file

@ -1,4 +1,5 @@
using Cirno.Scripts.Activables;
using System.Threading.Tasks;
using Cirno.Scripts.Activables;
using Godot;
namespace Cirno.Scripts.Actors;
@ -13,6 +14,8 @@ public partial class AlarmTeleporterActorSpawner : ActorSpawner
[Export]
public float ActivationRange { get; private set; }
[Export] public float ActivationDelay { get; private set; } = 2f;
public override void _Ready()
{
_alarmManager = this.GetAlarmManager();
@ -22,6 +25,13 @@ public partial class AlarmTeleporterActorSpawner : ActorSpawner
private void AlarmManagerOnAlarmEnabled(Vector2 location)
{
if (!(location.DistanceTo(this.GlobalPosition) <= ActivationRange)) return;
_ = DelaySpawn();
}
private async Task DelaySpawn()
{
await Task.Delay((int)(1000 * ActivationDelay));
Teleporter?.FireParticles();
Spawn();
}