using UnityEngine; namespace OnlyScove.Scripts { public class PlayerAirDashState : PlayerBaseState { private float dashDuration = 0.3f; private float dashTimer; private Vector3 dashDirection; public PlayerAirDashState(PlayerStateMachine stateMachine) : base(stateMachine) {} public override void Enter() { dashTimer = dashDuration; stateMachine.Anim.SetTrigger("Dash"); // ĐÚNG: Sử dụng MoveInput đã đồng bộ Vector2 input = stateMachine.MoveInput; if (input != Vector2.zero) { dashDirection = new Vector3(input.x, 0, input.y).normalized; dashDirection = stateMachine.NetworkedCameraRotation * dashDirection; } else { dashDirection = stateMachine.transform.forward; } dashDirection.y = 0; dashDirection.Normalize(); } public override void Tick(float deltaTime) { dashTimer -= deltaTime; // Sử dụng hàm Move tập trung stateMachine.Move(dashDirection * stateMachine.DashForce, 1.0f, deltaTime); if (dashTimer <= 0) { stateMachine.SwitchState(new PlayerFallState(stateMachine)); } } public override void PhysicsTick(float fixedDeltaTime) {} public override void Exit() {} } }