update MUTIPLAY

This commit is contained in:
2026-04-05 00:08:43 +07:00
parent 95b94260ac
commit e6deb358df
13 changed files with 285 additions and 91 deletions

View File

@@ -23,26 +23,25 @@ namespace OnlyScove.Scripts
public override void Tick(float deltaTime)
{
stateMachine.Anim.SetFloat(speedHash, 0f, stateMachine.AnimationDamping, deltaTime);
stateMachine.Anim.SetFloat(speedXHash, 0f, stateMachine.AnimationDamping, deltaTime);
stateMachine.Anim.SetFloat(speedZHash, 0f, stateMachine.AnimationDamping, deltaTime);
if (stateMachine.Input.MoveInput != Vector2.zero)
{
stateMachine.SwitchState(new PlayerMoveState(stateMachine));
return;
}
// Cập nhật trọng lực
if (stateMachine.IsGrounded && stateMachine.VelocityY < 0)
{
stateMachine.VelocityY = -2f;
}
else
{
stateMachine.VelocityY += Physics.gravity.y * deltaTime;
stateMachine.VelocityY += stateMachine.Gravity * deltaTime;
}
// Sử dụng hàm Move tập trung để đồng bộ Animator và Vị trí
stateMachine.Move(new Vector3(0, stateMachine.VelocityY, 0), 0f, deltaTime);
// QUAN TRỌNG: Đọc dữ liệu đã đồng bộ từ mạng (stateMachine.MoveInput)
if (stateMachine.MoveInput != Vector2.zero)
{
stateMachine.SwitchState(new PlayerMoveState(stateMachine));
return;
}
stateMachine.Controller.Move(new Vector3(0, stateMachine.VelocityY, 0) * deltaTime);
}
public override void PhysicsTick(float fixedDeltaTime) {}