Editor/Stair/ArchExteriorStairAuthoring.cs

Editor authoring component for exterior stairs. It previews an exterior stair placement by resolving a sketch, drawing ghost geometry for flights and landings, and annotating a note; it also forwards actual placement to ArchExteriorStair.Place.

File Access
namespace Sunless.Architecture;

public sealed class ArchExteriorStairAuthoring : IArchExteriorStairs
{
	public bool Preview( ArchPlan plan, ArchKit kit, ArchFixtureStation? at, ArchExteriorStairPart draft )
	{
		if ( ArchExteriorStair.Place( plan, kit, at, draft, out var host ) is not { } sketch )
		{
			return false;
		}

		var shape = ArchExteriorStair.Resolve( sketch, host, kit );

		foreach ( var leg in shape.Flights )
		{
			ArchStairGhost.Flight( leg.Shape, leg.Stair.BaseHeight );
		}

		foreach ( var landing in shape.Landings )
		{
			ArchGhost.Ring( landing.Outline, landing.Height );
		}

		ArchGhost.Note( new Vector3( sketch.Anchor.x, sketch.Anchor.y, sketch.TopHeight + 8f ),
			$"fire escape — {sketch.Rise:0} climb, {shape.Landings.Count} landings" );

		return true;
	}

	public ArchExteriorStairPart Place( ArchPlan plan, ArchKit kit, ArchFixtureStation? at, ArchExteriorStairPart draft, out ArchBuilding host )
	{
		return ArchExteriorStair.Place( plan, kit, at, draft, out host );
	}
}