using UnityEngine; namespace OnlyScove.Scripts { public class PlayerThrustState : PlayerBaseState { private readonly int thrustHash = Animator.StringToHash("Thrust"); public PlayerThrustState(PlayerStateMachine stateMachine) : base(stateMachine) {} public override void Enter() { stateMachine.AnimationHandler.SafeSetTrigger(thrustHash); // Immediately set a massive downward velocity stateMachine.VelocityY = stateMachine.ThrustDownwardForce; } public override void Tick(float deltaTime) { // Keep applying heavy gravity just in case stateMachine.VelocityY += (stateMachine.Gravity * 2f) * deltaTime; // Move the player straight down (no horizontal movement allowed during thrust) Vector3 fallMovement = new Vector3(0f, stateMachine.VelocityY, 0f); stateMachine.Controller.Move(fallMovement * deltaTime); // When we smash into the ground... if (stateMachine.Controller.isGrounded) { stateMachine.VelocityY = -2f; // TODO: Add impact effects, screen shake, or damage area here! // Return to idle after landing stateMachine.SwitchState(new PlayerIdleState(stateMachine)); } } public override void PhysicsTick(float fixedDeltaTime) {} public override void Exit() {} } }