b451f83174
Captures the pre-Godot-port state of the codebase. This is the rollback anchor for the Godot port (M0 of theriapolis-rpg-implementation-plan-godot-port.md). All Phase 0 through Phase 6.5 work is included; Phase 7 is in flight. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
30 lines
921 B
C#
30 lines
921 B
C#
using Theriapolis.Core.Util;
|
||
|
||
namespace Theriapolis.Core.World;
|
||
|
||
/// <summary>
|
||
/// A bridge where a road or rail polyline crosses a river.
|
||
/// Endpoints are in world-pixel space and follow the actual road polyline,
|
||
/// so the deck visually matches the road at the crossing regardless of meander.
|
||
/// </summary>
|
||
public readonly struct Bridge
|
||
{
|
||
public readonly Vec2 Start;
|
||
public readonly Vec2 End;
|
||
public readonly int RoadId;
|
||
|
||
public Bridge(Vec2 start, Vec2 end, int roadId)
|
||
{
|
||
Start = start;
|
||
End = end;
|
||
RoadId = roadId;
|
||
}
|
||
|
||
/// <summary>Center of the deck (midpoint of Start–End).</summary>
|
||
public float WorldPixelX => (Start.X + End.X) * 0.5f;
|
||
public float WorldPixelY => (Start.Y + End.Y) * 0.5f;
|
||
|
||
/// <summary>Road direction angle (radians) from Start to End.</summary>
|
||
public float RoadAngle => MathF.Atan2(End.Y - Start.Y, End.X - Start.X);
|
||
}
|