39 lines
1 KiB
GDScript
Executable file
39 lines
1 KiB
GDScript
Executable file
class_name Tile
|
|
extends Node3D
|
|
|
|
@export var coordinate :Vector2i
|
|
@onready var mesh_instance_3d: MeshInstance3D = $MeshInstance3D
|
|
|
|
const TILE_LIGHT = preload("uid://drsd4o5kptjhm")
|
|
const HIGHLIGHT = preload("uid://d3ognkvbqsh4u")
|
|
|
|
signal is_clicked(Vector2i)
|
|
|
|
func set_coord(vec):
|
|
coordinate = vec
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
pass # Replace with function body.
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
pass
|
|
|
|
|
|
func _on_area_3d_mouse_entered() -> void:
|
|
mesh_instance_3d.material_overlay = HIGHLIGHT
|
|
pass # Replace with function body.
|
|
|
|
|
|
func _on_area_3d_mouse_exited() -> void:
|
|
mesh_instance_3d.material_overlay = null
|
|
pass # Replace with function body.
|
|
|
|
|
|
|
|
func _on_area_3d_input_event(camera: Node, event: InputEvent, event_position: Vector3, normal: Vector3, shape_idx: int) -> void:
|
|
if event.is_action_pressed("action"):
|
|
#print("is clicked!")
|
|
is_clicked.emit(coordinate)
|
|
pass # Replace with function body.
|