mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-18 00:03:47 +00:00
Elevators move players
This commit is contained in:
parent
8b378abef3
commit
2e0ad40f33
8 changed files with 156 additions and 93 deletions
|
|
@ -8,40 +8,10 @@ using GTweensGodot.Extensions;
|
|||
|
||||
namespace Cirno.Scripts.Components.FSM.Elevator;
|
||||
|
||||
public partial class Ascending : BaseState<ElevatorState, ElevatorProxy>
|
||||
public partial class Ascending : ElevatorMovementState
|
||||
{
|
||||
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);
|
||||
}
|
||||
protected override Vector2 StartingPosition => MainObject.Bottom;
|
||||
protected override Vector2 EndingPosition => MainObject.Top;
|
||||
protected override ElevatorState EndState => ElevatorState.Top;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue