major refactor(game-modes): centralize scoring and turn handling
* Move common ball recording, scoring, and turn-switching logic into `BaseMode` * Add hooks for mode-specific ball handling and turn behavior * Simplify 8-ball and 9-ball modes to use `LastBallMode` * Update Snooker to use the new ball-processing hooks * Remove duplicated scoring and turn-management code
This commit is contained in:
16
controllers/game/modes/last_ball_mode.gd
Normal file
16
controllers/game/modes/last_ball_mode.gd
Normal file
@@ -0,0 +1,16 @@
|
||||
class_name LastBallMode extends BaseMode
|
||||
|
||||
|
||||
@export var final_ball_name: String = ""
|
||||
|
||||
|
||||
func on_ball_reaped(ball: Node3D) -> void:
|
||||
if ball.name == final_ball_name:
|
||||
ball_states[ball.name]["is_foul"] = true
|
||||
|
||||
func on_ball_sunk(ball: Node3D) -> void:
|
||||
if ball.name == final_ball_name:
|
||||
ball_states[ball.name]["is_foul"] = true
|
||||
|
||||
func process_win_condition() -> void:
|
||||
pass
|
||||
Reference in New Issue
Block a user