mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-13 19:55:55 +00:00
Changed player to new one
This commit is contained in:
parent
60ab375572
commit
1c1436a539
27 changed files with 323 additions and 87 deletions
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Cirno.Scripts.Components.FSM;
|
||||
using Godot;
|
||||
using GTweensGodot.Extensions;
|
||||
|
||||
|
|
@ -115,7 +116,7 @@ private AudioStreamPlayer2D _teleportEndSound;
|
|||
|
||||
private void _on_body_entered(CharacterBody2D area)
|
||||
{
|
||||
if (area is not PlayerMovement player) return;
|
||||
if (area is not PlayerStateMachine player) return;
|
||||
|
||||
if (!IsPrimed)
|
||||
{
|
||||
|
|
@ -132,10 +133,11 @@ private AudioStreamPlayer2D _teleportEndSound;
|
|||
_ = Teleport(player);
|
||||
}
|
||||
|
||||
protected virtual async Task Teleport(PlayerMovement player)
|
||||
protected virtual async Task Teleport(PlayerStateMachine player)
|
||||
{
|
||||
if (Target is null) return;
|
||||
player.RequestMovementDisable(true);
|
||||
//player.RequestMovementDisable(true);
|
||||
player.SetState((int)PlayerState.Cutscene);
|
||||
|
||||
await TweenPlayer(player);
|
||||
|
||||
|
|
@ -144,16 +146,22 @@ private AudioStreamPlayer2D _teleportEndSound;
|
|||
//_particles.Emitting = true;
|
||||
FireParticles();
|
||||
|
||||
await player.Teleport();
|
||||
//await player.Teleport();
|
||||
player.SetState((int)PlayerState.Teleporting);
|
||||
await Task.Delay((int)(0.6f * 1000));
|
||||
|
||||
await Task.Delay((int)(TeleportAnimationLength * 1000));
|
||||
|
||||
Target.PrepareForReceiving();
|
||||
player.GlobalPosition = Target.GlobalPosition + TeleportOffset;
|
||||
Target.PlayTeleportEndSound();
|
||||
await player.UnTeleport();
|
||||
//await player.UnTeleport();
|
||||
|
||||
player.RequestMovementDisable(false);
|
||||
player.SetState((int)PlayerState.UnTeleporting);
|
||||
await Task.Delay((int)(0.6f * 1000));
|
||||
|
||||
//player.RequestMovementDisable(false);
|
||||
player.SetState((int)PlayerState.Active);
|
||||
}
|
||||
|
||||
public void PlayTeleportStartSound()
|
||||
|
|
@ -166,7 +174,7 @@ private AudioStreamPlayer2D _teleportEndSound;
|
|||
_teleportEndSound?.Play();
|
||||
}
|
||||
|
||||
protected async Task TweenPlayer(PlayerMovement player)
|
||||
protected async Task TweenPlayer(PlayerStateMachine player)
|
||||
{
|
||||
await player.TweenGlobalPosition(GlobalPosition + new Vector2(0, -4f), TeleportAnimationLength).PlayAsync(CancellationToken.None);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue