refactor to state machine

This commit is contained in:
2025-02-02 01:08:44 +09:00
parent c8c5c08b4d
commit be682b2813
18 changed files with 379 additions and 121 deletions
+16 -1
View File
@@ -1,4 +1,19 @@
extends State
func process_physics(delta: float) -> State:
return
if not multiplayer.is_server():
return
var target_velocity = Vector3(0, subject.velocity.y, 0)
subject.velocity = subject.velocity.move_toward(target_velocity, subject.acceleration * delta)
subject.velocity += Main.gravity_velocity
subject.move_and_slide()
if not subject.is_on_floor():
return %Fall
var input_direction = %Input.direction
if input_direction.length() < 0.05:
return
return %Run