mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 21:25:54 +00:00
48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
|
|
using System.Threading.Tasks;
|
|||
|
|
using Cirno.Scripts.Components.FSM._3DPlayer;
|
|||
|
|
using Godot;
|
|||
|
|
using Godot.Collections;
|
|||
|
|
|
|||
|
|
namespace Cirno.Scripts.Activables._3D;
|
|||
|
|
|
|||
|
|
[Tool]
|
|||
|
|
public partial class LevelTeleporter3D : Teleporter3D
|
|||
|
|
{
|
|||
|
|
[Export] public bool SaveInventory { get; set; }
|
|||
|
|
|
|||
|
|
public override void _func_godot_apply_properties(Dictionary<string, Variant> props)
|
|||
|
|
{
|
|||
|
|
// TargetGroup = props["target"].AsString();
|
|||
|
|
//
|
|||
|
|
// TargetName = props["targetname"].AsString();
|
|||
|
|
IsEnabled = props["enabled"].AsBool();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected override async Task Teleport(IsoPlayerStateMachine player)
|
|||
|
|
{
|
|||
|
|
player.SetState(PlayerState.Cutscene);
|
|||
|
|
await TweenPlayer(player.MainObject);
|
|||
|
|
|
|||
|
|
PlayTeleportStartSound();
|
|||
|
|
FireParticles();
|
|||
|
|
|
|||
|
|
player.SetState(PlayerState.Teleporting);
|
|||
|
|
|
|||
|
|
await Task.Delay((int)(0.6f * 1000));
|
|||
|
|
|
|||
|
|
await Task.Delay((int)(TeleportAnimationLength * 1000));
|
|||
|
|
|
|||
|
|
if (SaveInventory)
|
|||
|
|
{
|
|||
|
|
// Save inventory
|
|||
|
|
GlobalState.Instance.SessionSettings.Items = InventoryManager.Instance.Save();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
GlobalState.Instance.SessionSettings.EquippedWeaponId = string.Empty;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var nextMap = GlobalState.Instance.MapsDatabase.FindNextMap(GlobalState.Instance.SessionSettings.MapId);
|
|||
|
|
GlobalState.Instance.GotoScene(nextMap);
|
|||
|
|
}
|
|||
|
|
}
|