extends CanvasLayer

@export var _combo_timer: Timer

var _id: int


func _ready() -> void:
	_id = multiplayer.get_unique_id()
	GameState.fetch().player_data[_id].water_combo_update.connect(
		func(current: int):
			if current == 0:
				$Combo.hide()
			else:
				$Combo.show()
				$Combo.text = "+" + str(current) + "!"
			_combo_timer.start()
	)


func _on_combo_timer_timeout() -> void:
	GameState.fetch().player_data[_id].reset_water_combo()
	$Combo.hide()
