cirnogodot/Scripts/Activables/LevelTeleporter.cs
2025-03-05 10:55:14 +01:00

32 lines
No EOL
876 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(IStateMachine<PlayerState, CharacterBody2D> player)
{
if (string.IsNullOrWhiteSpace(LevelPath)) return;
//player.RequestMovementDisable(true);
player.SetState(PlayerState.Cutscene);
await TweenPlayer(player.MainObject);
_particles.Emitting = true;
//await player.Teleport();
player.SetState(PlayerState.UnTeleporting);
await Task.Delay((int)(0.6f * 1000));
await Task.Delay((int)(TeleportAnimationLength * 1000));
GlobalState.Instance.GotoScene(LevelPath);
}
}