mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 14:55:54 +00:00
State persistance between scenes
This commit is contained in:
parent
1e38945f63
commit
35254935e4
13 changed files with 142 additions and 27 deletions
|
|
@ -6,10 +6,11 @@ using Godot;
|
|||
|
||||
namespace Cirno.Scripts.Activables;
|
||||
|
||||
public partial class LevelTeleporter : Teleporter
|
||||
public partial class LevelTeleporter : Teleporter
|
||||
{
|
||||
[Export]
|
||||
public string LevelPath {get; private set;}
|
||||
[Export] public string LevelPath { get; private set; }
|
||||
|
||||
[Export] public bool SaveInventory { get; private set; }
|
||||
|
||||
protected override async Task Teleport(IStateMachine<PlayerState, CharacterBody2D> player)
|
||||
{
|
||||
|
|
@ -20,13 +21,19 @@ public partial class LevelTeleporter : Teleporter
|
|||
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));
|
||||
|
||||
if (SaveInventory)
|
||||
{
|
||||
// Save inventory
|
||||
GlobalState.Instance.SessionSettings.Items = InventoryManager.Instance.Save();
|
||||
}
|
||||
|
||||
GlobalState.Instance.GotoScene(LevelPath);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue