34 lines
677 B
GDScript3
Raw Normal View History

class_name Tile extends Node2D
2026-04-13 11:34:00 -05:00
@warning_ignore("unused_signal")
2026-04-13 11:34:00 -05:00
signal tile_selected(tile: Tile)
@export var coords: Vector2i
@export var cost: int = 0
2026-04-13 11:34:00 -05:00
var highlighted: bool = false
var is_placing: bool = false
2026-04-13 11:34:00 -05:00
2026-04-13 11:34:00 -05:00
func handle_mouse_entered() -> void:
highlighted = true
2026-04-13 11:34:00 -05:00
func handle_mouse_exited() -> void:
highlighted = false
func serialize() -> Dictionary:
var result = {}
result["scene_file_path"] = scene_file_path
result["coords"] = coords
result["cost"] = cost
return result
static func deserialize(data: Dictionary) -> Tile:
var tile: Tile = load(data["scene_file_path"]).instantiate()
tile.coords = data["coords"]
tile.cost = data["cost"]
return tile