summaryrefslogtreecommitdiff
path: root/Game/Selection/selectable_area.gd
blob: 0b3557d320f0b039195c78bd5b65af7a3a6f6251 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
extends Area2D


signal hover_enter
signal hover_exit

signal select_primary(event: InputEvent)
signal select_secondary(event: InputEvent)


#func _on_area_entered(_area: Area2D) -> void:
	#hover_enter.emit()
#
#
#func _on_area_exited(_area: Area2D) -> void:
	#hover_exit.emit()


func _on_mouse_entered() -> void:
	if not get_tree().get_first_node_in_group("selection_rectangle").is_active:
		hover_enter.emit()


func _on_mouse_exited() -> void:
	if not get_tree().get_first_node_in_group("selection_rectangle").is_active:
		hover_exit.emit()


func _on_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void:
	if event.is_action_pressed("select"):
		select_primary.emit(event)
	if event.is_action_pressed("select_secondary"):
		select_secondary.emit(event)