extends Node3D
## Tower Defense — Lecture 27 (Starter)
##
## Generates a visual grid overlay to show where towers
## can be placed. Grid lines are subtle and persistent.

# ============================================================
# CONSTANTS
# ============================================================

const GRID_SIZE := 2.0  # Size of each grid cell
const GRID_WIDTH := 20  # Number of cells in X direction
const GRID_DEPTH := 15  # Number of cells in Z direction
const LINE_WIDTH := 0.05
const LINE_HEIGHT := 0.02

# ============================================================
# GRID APPEARANCE
# ============================================================

var grid_color := Color(0.3, 0.3, 0.3, 0.3)  # Subtle gray

# ============================================================
# LIFECYCLE
# ============================================================

func _ready() -> void:
	_generate_grid_lines()


## Generate grid line meshes
func _generate_grid_lines() -> void:
	# === TODO 1: Generate grid lines ===
	# Create a StandardMaterial3D with:
	#   - albedo_color = grid_color
	#   - transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
	#   - shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
	#
	# Calculate grid bounds:
	#   half_width = (GRID_WIDTH * GRID_SIZE) / 2.0
	#   half_depth = (GRID_DEPTH * GRID_SIZE) / 2.0
	#
	# Generate lines parallel to Z axis (GRID_WIDTH + 1 lines):
	#   For i in range(GRID_WIDTH + 1):
	#     x = -half_width + i * GRID_SIZE
	#     Create CSGBox3D with size (LINE_WIDTH, LINE_HEIGHT, GRID_DEPTH * GRID_SIZE)
	#     Set material, position to (x, 0.01, 0), add as child
	#
	# Generate lines parallel to X axis (GRID_DEPTH + 1 lines):
	#   For j in range(GRID_DEPTH + 1):
	#     z = -half_depth + j * GRID_SIZE
	#     Create CSGBox3D with size (GRID_WIDTH * GRID_SIZE, LINE_HEIGHT, LINE_WIDTH)
	#     Set material, position to (0, 0.01, z), add as child
	pass
