mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-05 02:55:53 +00:00
47 lines
No EOL
1 KiB
C#
47 lines
No EOL
1 KiB
C#
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Cirno.Scripts.Enums;
|
|
using Godot;
|
|
using GTweens.Builders;
|
|
using GTweens.Tweens;
|
|
using GTweensGodot.Extensions;
|
|
|
|
namespace Cirno.Scripts.Components.FSM.Elevator;
|
|
|
|
public partial class Ascending : BaseState<ElevatorState, ElevatorProxy>
|
|
{
|
|
public override ElevatorState StateId => ElevatorState.Ascending;
|
|
|
|
private GTween _tween;
|
|
|
|
public override void EnterState()
|
|
{
|
|
_tween?.Kill();
|
|
MainObject.SetPosition(MainObject.Bottom);
|
|
Ascend();
|
|
}
|
|
|
|
public override void ExitState()
|
|
{
|
|
_tween?.Kill();
|
|
}
|
|
|
|
private void Ascend()
|
|
{
|
|
// Grab player if in range
|
|
|
|
//Ascend
|
|
_ = RisingAnimation();
|
|
}
|
|
|
|
private async Task RisingAnimation()
|
|
{
|
|
_tween = GTweenSequenceBuilder.New()
|
|
.Append(MainObject.TweenPosition(MainObject.Top, MainObject.MovementTime))
|
|
.Build();
|
|
|
|
await _tween.PlayAsync(CancellationToken.None);
|
|
|
|
StateMachine.SetState(ElevatorState.Top);
|
|
}
|
|
} |