Enable placeable sun deck attractions and finish project rebrand

This commit is contained in:
josh
2026-11-28 20:33:30 -05:00
parent 56fafba6d9
commit ce0d38c8de
352 changed files with 1523 additions and 552 deletions

View File

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace BigShipTycoon
{
internal enum StationKind { Helm, Engine, Galley, Stores, Maintenance, Water, Waste, Cabins, Dining, Bar, Stage, Pool, Retail, Laundry, Casino }
internal readonly struct ShipStation
{
public readonly StationKind Kind;
public readonly Vector3 Position;
public ShipStation(StationKind kind, Vector3 position)
{
Kind = kind;
Position = position;
}
}
public sealed partial class Harbor
{
internal bool TryGetFacingStation(out StationKind kind)
{
kind = default;
IReadOnlyList<ShipStation> targets = cameraMode switch
{
CameraMode.Bridge or CameraMode.DeckWalk => decks?.ActiveStations,
CameraMode.Service => serviceDeck?.Stations,
_ => null
};
if (targets == null || walkSpace == null)
return false;
Vector3 facing = Quaternion.Euler(freePitch, freeYaw, 0) * Vector3.forward;
float best = float.PositiveInfinity;
for (int i = 0; i < targets.Count; i++)
{
ShipStation station = targets[i];
Vector3 offset = station.Position - freePosition;
float distance = offset.magnitude;
if (distance < .05f || distance > 3.2f)
continue;
float alignment = Vector3.Dot(facing, offset) / distance;
if (alignment < .955f)
continue;
float score = distance + (1 - alignment) * 9;
if (score >= best || !walkSpace.HasSightLine(freePosition, station.Position))
continue;
best = score;
kind = station.Kind;
}
return !float.IsPositiveInfinity(best);
}
}
}