brackeys-12/ui/building_icon.gd

28 lines
505 B
GDScript3
Raw Normal View History

2024-09-12 02:40:54 +00:00
extends ColorRect
2024-09-14 00:09:38 +00:00
var key
var clicked = false
2024-09-12 02:40:54 +00:00
@onready var texture_rect: TextureRect = $TextureRect
2024-09-14 00:09:38 +00:00
func _on_mouse_handler_clicked() -> void:
clicked = true
func _on_mouse_handler_hovered() -> void:
pass # Replace with function body.
func _on_mouse_handler_unhovered() -> void:
if clicked:
Triggerer.trigger("drag_building", { "key": key })
clicked = false
func _on_mouse_handler_released() -> void:
if clicked:
Triggerer.trigger("select_building", { "key": key })
clicked = false