cirnogodot/Scripts/Activables/LevelTeleporter.cs

32 lines
850 B
C#
Raw Normal View History

2025-02-21 22:48:12 +01:00
using System;
using System.Collections;
using System.Threading.Tasks;
2025-03-02 11:58:30 +01:00
using Cirno.Scripts.Components.FSM;
2025-02-21 22:48:12 +01:00
using Godot;
namespace Cirno.Scripts.Activables;
public partial class LevelTeleporter : Teleporter
{
[Export]
2025-02-21 23:52:44 +01:00
public string LevelPath {get; private set;}
2025-02-21 22:48:12 +01:00
2025-03-02 11:58:30 +01:00
protected override async Task Teleport(PlayerStateMachine player)
2025-02-21 22:48:12 +01:00
{
2025-02-21 23:52:44 +01:00
if (string.IsNullOrWhiteSpace(LevelPath)) return;
2025-03-02 11:58:30 +01:00
//player.RequestMovementDisable(true);
player.SetState((int)PlayerState.Cutscene);
2025-02-21 22:48:12 +01:00
await TweenPlayer(player);
_particles.Emitting = true;
2025-03-02 11:58:30 +01:00
//await player.Teleport();
player.SetState((int)PlayerState.UnTeleporting);
await Task.Delay((int)(0.6f * 1000));
2025-02-22 14:45:46 +01:00
2025-02-21 22:48:12 +01:00
await Task.Delay((int)(TeleportAnimationLength * 1000));
2025-02-21 23:52:44 +01:00
GlobalState.Instance.GotoScene(LevelPath);
2025-02-21 22:48:12 +01:00
}
}