mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 13:25:54 +00:00
Teleport spawner tweaks
This commit is contained in:
parent
57cd2d797b
commit
2ba95ee922
5 changed files with 53 additions and 16 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue