mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 02:25:54 +00:00
Level teleporter
This commit is contained in:
parent
2124701d49
commit
f6c7f1e3bc
2 changed files with 31 additions and 4 deletions
26
Scripts/Activables/LevelTeleporter.cs
Normal file
26
Scripts/Activables/LevelTeleporter.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Threading.Tasks;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Activables;
|
||||
|
||||
public partial class LevelTeleporter : Teleporter
|
||||
{
|
||||
[Export]
|
||||
public new string Target {get; private set;}
|
||||
|
||||
protected override async Task Teleport(PlayerMovement player)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Target)) return;
|
||||
player.RequestMovementDisable(true);
|
||||
|
||||
await TweenPlayer(player);
|
||||
|
||||
_particles.Emitting = true;
|
||||
|
||||
await Task.Delay((int)(TeleportAnimationLength * 1000));
|
||||
|
||||
GlobalState.Instance.GotoScene(Target);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue