feat: Implement the core Stop 'n' Go game mechanic, including its manager, main scene, and associated animation assets.
This commit is contained in:
+15
-10
@@ -16,6 +16,7 @@ var portal_mode_winner_id: int = -1
|
||||
var is_match_ended: bool = false
|
||||
var obstacle_manager
|
||||
var portal_mode_manager
|
||||
var vfx_manager
|
||||
|
||||
# Minimal local state
|
||||
var _connection_check_timer: float = 0.0
|
||||
@@ -219,6 +220,11 @@ func _init_managers():
|
||||
add_child(obstacle_manager)
|
||||
obstacle_manager.initialize(self , $EnhancedGridMap)
|
||||
|
||||
# NEW: VFX Animation Manager for Ready-Go, Stop-Phase, etc.
|
||||
vfx_manager = load("res://scenes/animation.tscn").instantiate()
|
||||
vfx_manager.name = "VFXManager"
|
||||
add_child(vfx_manager)
|
||||
|
||||
# Connect signals for UI updates
|
||||
goals_cycle_manager.timer_updated.connect(_on_timer_updated)
|
||||
goals_cycle_manager.score_updated.connect(_on_score_updated)
|
||||
@@ -349,18 +355,17 @@ func broadcast_message(player_name: String, message: String, type: int = Message
|
||||
add_message_to_bar(player_name, message, type)
|
||||
|
||||
func _start_pre_game_countdown():
|
||||
"""Show a 3-second countdown on all clients before starting."""
|
||||
for i in range(3, 0, -1):
|
||||
if can_rpc():
|
||||
rpc("sync_countdown", str(i))
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
|
||||
"""Trigger the premium Ready-Go animation on all clients."""
|
||||
if can_rpc():
|
||||
rpc("sync_countdown", "GO!")
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
rpc("sync_ready_go")
|
||||
|
||||
if can_rpc():
|
||||
rpc("sync_countdown", "")
|
||||
# Delay game start until the 4.0s animation finishes
|
||||
await get_tree().create_timer(4.0).timeout
|
||||
|
||||
@rpc("call_local", "reliable")
|
||||
func sync_ready_go():
|
||||
if vfx_manager and vfx_manager.has_method("play_ready_go"):
|
||||
vfx_manager.play_ready_go()
|
||||
|
||||
@rpc("call_local", "reliable")
|
||||
func sync_countdown(text: String):
|
||||
|
||||
Reference in New Issue
Block a user