cirnogodot/Scripts/Activables/LevelTeleporter.cs
2025-03-02 11:58:46 +01:00

32 lines
No EOL
850 B
C#

using System;
using System.Collections;
using System.Threading.Tasks;
using Cirno.Scripts.Components.FSM;
using Godot;
namespace Cirno.Scripts.Activables;
public partial class LevelTeleporter : Teleporter
{
[Export]
public string LevelPath {get; private set;}
protected override async Task Teleport(PlayerStateMachine player)
{
if (string.IsNullOrWhiteSpace(LevelPath)) return;
//player.RequestMovementDisable(true);
player.SetState((int)PlayerState.Cutscene);
await TweenPlayer(player);
_particles.Emitting = true;
//await player.Teleport();
player.SetState((int)PlayerState.UnTeleporting);
await Task.Delay((int)(0.6f * 1000));
await Task.Delay((int)(TeleportAnimationLength * 1000));
GlobalState.Instance.GotoScene(LevelPath);
}
}