mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 08:23:45 +00:00
feat(goals): add cinematic celebration sequence
This commit is contained in:
@@ -37,6 +37,8 @@ var match_timer: Timer
|
||||
var _in_overtime := false
|
||||
var _match_over := false
|
||||
var _last_timer_remaining := -1
|
||||
var _pending_scoring_team := -1
|
||||
var _match_time_after_goal := -1.0
|
||||
|
||||
|
||||
func _get_arena_scene_path() -> String:
|
||||
@@ -79,16 +81,32 @@ func _process(_delta):
|
||||
timer_updated.emit(floori(remaining / 60.0), remaining % 60)
|
||||
|
||||
|
||||
func _on_goal_scored(conceding_team: int) -> void:
|
||||
func _on_goal_registered(conceding_team: int) -> void:
|
||||
if _match_over:
|
||||
return
|
||||
var scoring_team := 1 - conceding_team
|
||||
_record_goal(scoring_team)
|
||||
_pending_scoring_team = 1 - conceding_team
|
||||
_record_goal(_pending_scoring_team)
|
||||
score_changed.emit(score.duplicate())
|
||||
# Commit the score and freeze regulation time at sensor entry. The clock
|
||||
# resumes after the cinematic, so a last-second goal cannot be discarded or
|
||||
# reclassified as overtime while presentation is still running.
|
||||
if match_timer and match_timer.time_left > 0.0:
|
||||
_match_time_after_goal = match_timer.time_left
|
||||
match_timer.stop()
|
||||
|
||||
|
||||
func _on_goal_scored(_conceding_team: int) -> void:
|
||||
if _match_over or _pending_scoring_team < 0:
|
||||
return
|
||||
var scoring_team := _pending_scoring_team
|
||||
_pending_scoring_team = -1
|
||||
if _in_overtime:
|
||||
# Golden goal: the first score after a draw ends the match outright.
|
||||
_end_match(scoring_team)
|
||||
return
|
||||
if match_timer and _match_time_after_goal > 0.0:
|
||||
match_timer.start(_match_time_after_goal)
|
||||
_match_time_after_goal = -1.0
|
||||
await _run_kickoff_countdown()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user