extends PanelContainer var is_hovered = false @export var cost := 5 func _ready() -> void: tooltip_text = "Cost: " + str(cost) func _on_mouse_entered() -> void: is_hovered = true var stylebox := StyleBoxFlat.new() stylebox.bg_color = Color(1.0, 1.0, 1.0, 0.25) add_theme_stylebox_override("panel", stylebox) func _on_mouse_exited() -> void: is_hovered = false remove_theme_stylebox_override("panel") func _on_texture_rect_gui_input(event: InputEvent) -> void: var state: StateBuild = get_tree().current_scene.get_node("StateManager/StateBuild") if event.is_action_pressed("select") and not state.current_builder_element: var builder_element_scene = preload("res://Game/States/Build/BuilderElement.tscn") var builder_element = builder_element_scene.instantiate() builder_element.element = preload("res://Towers/Tower.tscn") get_tree().current_scene.add_child(builder_element) state.current_builder_element = builder_element