This commit is contained in:
Scove
2026-03-26 20:27:19 +07:00
parent a94ab0e3f6
commit f42ef22a13
129 changed files with 5517 additions and 1134 deletions

View File

@@ -0,0 +1,43 @@
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.Anim.SetTrigger(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() {}
}
}