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
+3 -6
View File
@@ -1,13 +1,10 @@
extends Node3D
const template := "FPS: %d\nPing: %d ms"
const statsTemplate := "FPS: %d\nPing: %d ms"
var runner_scene := preload("res://scenes/runner.tscn")
var _ping := 0.0
var _runners_node: Node3D
func _ready() -> void:
_runners_node = get_node("RunnersNode")
@onready var _runners_node: Node3D = %Runners
func spawn_player(player_id) -> void:
if multiplayer.is_server():
@@ -21,7 +18,7 @@ func _process(_delta: float) -> void:
if DisplayServer.get_name() == "headless":
return
%RichTextLabel.text = template % [
%StatsLabel.text = statsTemplate % [
Engine.get_frames_per_second(),
_ping,
]