Editor/Road/ArchBridgeShapeBuilder.cs

A small fluent builder for creating an ArchBridgeShape. It stores references to parts of a bridge build (road, bridge part, plan, curve, frames, kit, ground) and returns an ArchBridgeShape by calling ArchBridge.ResolveCore with those values.

using System;
using System.Collections.Generic;
using Sandbox;

namespace Sunless.Architecture;

public sealed class ArchBridgeShapeBuilder
{
	ArchRoadPart road;
	ArchBridgePart part;
	ArchPlan plan;
	ArchCurve curve;
	IReadOnlyList<ArchFrame> frames;
	ArchKit kit;
	ArchGround ground;

	public ArchBridgeShapeBuilder On( ArchRoadPart road, ArchBridgePart part )
	{
		this.road = road;
		this.part = part;

		return this;
	}

	public ArchBridgeShapeBuilder WithPlan( ArchPlan plan )
	{
		this.plan = plan;

		return this;
	}

	public ArchBridgeShapeBuilder Along( ArchCurve curve )
	{
		this.curve = curve;

		return this;
	}

	public ArchBridgeShapeBuilder WithFrames( IReadOnlyList<ArchFrame> frames )
	{
		this.frames = frames;

		return this;
	}

	public ArchBridgeShapeBuilder WithKit( ArchKit kit )
	{
		this.kit = kit;

		return this;
	}

	public ArchBridgeShapeBuilder Over( ArchGround ground )
	{
		this.ground = ground;

		return this;
	}

	public ArchBridgeShape Create()
	{
		return ArchBridge.ResolveCore( road, part, plan, curve, frames, kit, ground );
	}
}