extends Path3D
## Tower Defense — Lecture 26 (Starter)
##
## Generates visual road segments along a Path3D curve
## to show the enemy path clearly.

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

const ROAD_WIDTH := 2.0
const ROAD_HEIGHT := 0.1
const SEGMENT_LENGTH := 1.0  # Distance between road tiles

# ============================================================
# ROAD APPEARANCE
# ============================================================

var road_color := Color(0.3, 0.25, 0.2)  # Brown/dirt color

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

func _ready() -> void:
	_generate_road_tiles()


## Generate CSG road tiles along the curve
func _generate_road_tiles() -> void:
	# === TODO 1: Generate road tiles along the curve ===
	# Check if curve is null or has fewer than 2 points (return early if so)
	# Get total_length from curve.get_baked_length()
	# Initialize current_distance to 0.0
	# Create a StandardMaterial3D with road_color
	#
	# Loop while current_distance < total_length:
	#   Sample position at current_distance using curve.sample_baked()
	#   Sample next position at current_distance + 0.1 for direction
	#   Calculate direction = (next_pos - pos).normalized()
	#
	#   Create CSGBox3D tile with size Vector3(ROAD_WIDTH, ROAD_HEIGHT, SEGMENT_LENGTH)
	#   Set tile.material to the road material
	#   Position tile at pos with y=0.05 (slightly above ground)
	#
	#   If direction.length() > 0.01:
	#     Use tile.look_at(pos + direction, Vector3.UP)
	#     Rotate tile by PI/2 around Y axis to align length with path
	#
	#   Add tile as child
	#   Increment current_distance by SEGMENT_LENGTH
	pass
