Major changes to editor tools, and adding new layer for buildable towers

This commit is contained in:
Matt F 2026-05-01 10:50:03 -07:00
parent a4e28bc93f
commit b44eeaeeff
21 changed files with 2867 additions and 89 deletions

View file

@ -70,39 +70,12 @@ namespace TD.Levels
public bool alwaysShowGoals = false;
// -------------------------------------------------------------------
// Bake API (stubs this session — full implementation comes next session).
// Bake API
// -------------------------------------------------------------------
/// <summary>
/// Runs the seven-phase bake algorithm and writes the result into <see cref="targetAsset"/>.
/// </summary>
/// <returns>True if the bake succeeded (with or without warnings); false if validation
/// failed or any other hard error occurred. On failure, the existing targetAsset on disk
/// is left untouched.</returns>
/// <remarks>
/// STUB — full implementation is the next session's work. Currently logs a not-implemented
/// message and returns false.
/// </remarks>
public bool BakeLevelData()
{
Debug.LogWarning("[LevelAuthoring] BakeLevelData is not yet implemented. " +
"The seven-phase bake algorithm will be added in the next session.");
return false;
}
/// <summary>
/// Re-renders just the lobby thumbnail without doing a full bake. Useful when only visual
/// scene content (terrain, decorations) has changed.
/// </summary>
/// <remarks>
/// STUB — full implementation is part of the bake script work. Currently logs a
/// not-implemented message.
/// </remarks>
public void RefreshThumbnail()
{
Debug.LogWarning("[LevelAuthoring] RefreshThumbnail is not yet implemented. " +
"Thumbnail rendering will be added with the bake script.");
}
// The bake operation is implemented in TD.Levels.Editor.LevelBakePipeline (in the Editor
// assembly). It cannot be exposed as a method on this runtime class because the runtime
// assembly cannot reference types in the Editor assembly. The custom inspector's "Bake
// LevelData" button invokes the pipeline directly.
// -------------------------------------------------------------------
// Map-level gizmos: origin marker, map bounding rect, combined player zone outlines.
@ -130,14 +103,14 @@ namespace TD.Levels
Vector3 origin = new Vector3(0f, OriginMarkerY, 0f);
Gizmos.DrawSphere(origin, 0.1f);
Gizmos.DrawLine(origin + new Vector3(-OriginMarkerSize, 0f, 0f),
origin + new Vector3( OriginMarkerSize, 0f, 0f));
origin + new Vector3(OriginMarkerSize, 0f, 0f));
Gizmos.DrawLine(origin + new Vector3(0f, 0f, -OriginMarkerSize),
origin + new Vector3(0f, 0f, OriginMarkerSize));
origin + new Vector3(0f, 0f, OriginMarkerSize));
Gizmos.color = prev;
#if UNITY_EDITOR
Handles.Label(origin + new Vector3(0.15f, 0.05f, 0.15f), "Tile (0,0)");
Handles.Label(origin + new Vector3(0.15f, 0.05f, 0.15f), "World Origin (0,0)");
#endif
}
@ -195,7 +168,21 @@ namespace TD.Levels
Gizmos.DrawLine(ne, nw);
Gizmos.DrawLine(nw, sw);
// Map SW corner marker — a small filled square so it reads distinctly from the
// world-origin sphere+cross when both are visible. Sized slightly above the bounds
// line so it doesn't z-fight.
Vector3 swMarkerCenter = new Vector3(sw.x, MapBoundsY + 0.005f, sw.z);
Gizmos.color = new Color(1f, 0.85f, 0.2f, 0.9f); // amber, distinct from origin's white
Gizmos.DrawCube(swMarkerCenter, new Vector3(0.25f, 0.01f, 0.25f));
Gizmos.color = prev;
#if UNITY_EDITOR
// Place label slightly inside the map bounds (NE of the corner) so it doesn't get
// covered by the world-origin label when the map is aligned.
Handles.Label(swMarkerCenter + new Vector3(0.2f, 0.05f, 0.2f),
$"Map SW: tile ({minTile.x}, {minTile.y})");
#endif
}
private void DrawCombinedPlayerZoneOutlines()