mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:05:34 +00:00
Level Teleporters
This commit is contained in:
parent
5e357e1a96
commit
7a8bb4311b
26 changed files with 581 additions and 410 deletions
48
Scripts/Activables/3D/LevelTeleporter3D.cs
Normal file
48
Scripts/Activables/3D/LevelTeleporter3D.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue