generated from krampus/template-godot4
36 lines
742 B
GDScript
36 lines
742 B
GDScript
class_name Turn extends Tile
|
|
|
|
@export var direction: Board.Direction
|
|
|
|
@onready var highlight: Panel = %Highlight
|
|
@onready var player_border: PanelContainer = %PlayerBorder
|
|
|
|
|
|
func _ready() -> void:
|
|
_set_border_color()
|
|
|
|
|
|
func handle_turn_mouse_entered() -> void:
|
|
highlight.show()
|
|
|
|
|
|
func handle_turn_mouse_exited() -> void:
|
|
highlight.hide()
|
|
|
|
|
|
func handle_gui_input(event: InputEvent):
|
|
if event.is_action_pressed("select") and !is_placing:
|
|
tile_selected.emit(self)
|
|
|
|
|
|
func _set_player(value: Player) -> void:
|
|
super(value)
|
|
_set_border_color()
|
|
|
|
|
|
func _set_border_color() -> void:
|
|
if !is_node_ready() or player == null:
|
|
return
|
|
var style_box: StyleBoxFlat = player_border.get_theme_stylebox("panel")
|
|
style_box.border_color = player.color
|