mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 08:23:45 +00:00
perf(match): emit timer_updated only when the displayed second changes
match_mode.gd fired the signal every frame while only the once-a-second value is displayed, forcing the HUD to re-format and re-shape the label each frame. Gate emission on the whole-second value changing, matching ship.gd's threshold-gated telemetry discipline.
This commit is contained in:
@@ -30,6 +30,7 @@ const KICKOFF_COUNTDOWN_SECONDS := 3
|
||||
var match_timer: Timer
|
||||
var _in_overtime := false
|
||||
var _match_over := false
|
||||
var _last_timer_remaining := -1
|
||||
|
||||
|
||||
func _get_arena_scene_path() -> String:
|
||||
@@ -64,7 +65,9 @@ func _make_opponent_controller() -> ShipController:
|
||||
func _process(_delta):
|
||||
if match_timer and match_timer.time_left > 0:
|
||||
var remaining := ceili(match_timer.time_left)
|
||||
timer_updated.emit(floori(remaining / 60.0), remaining % 60)
|
||||
if remaining != _last_timer_remaining:
|
||||
_last_timer_remaining = remaining
|
||||
timer_updated.emit(floori(remaining / 60.0), remaining % 60)
|
||||
|
||||
|
||||
func _on_goal_scored(conceding_team: int) -> void:
|
||||
|
||||
Reference in New Issue
Block a user