Scale docking momentum by hull, require manual mooring and channel maneuvers in Captain Career, and add rank-specific bridge instruments and voiced training.
132 lines
4.4 KiB
C#
132 lines
4.4 KiB
C#
using UnityEngine;
|
|
|
|
namespace BigShipTycoon
|
|
{
|
|
public sealed partial class TycoonApp
|
|
{
|
|
private static readonly float[] DockRadarRanges = { 75f, 150f, 300f, 600f };
|
|
|
|
private DockManeuver ActiveDockManeuver => underway != null && Ship != null
|
|
&& fleetPassages.TryGetValue(Ship, out FleetPassage passage) ? passage.Dock : null;
|
|
|
|
private void FocusDockManeuver(DockManeuver dock)
|
|
{
|
|
ResetPassageView();
|
|
passageBusinessOpen = false;
|
|
ReleaseHelm();
|
|
harbor.PresentDockBridge(null, 0, false);
|
|
harbor.ShowDeck(-1);
|
|
harbor.BeginDockManeuver(dock.Arriving ? underway.Destination : underway.Origin, dock);
|
|
harbor.PresentDockManeuver(dock, 0);
|
|
}
|
|
|
|
private void BeginDockArrival(FleetPassage passage, Ship ship)
|
|
{
|
|
passage.Dock = new DockManeuver(ship.HullIndex, true, passage.Helm.Speed);
|
|
passage.Speed = 1;
|
|
passage.RestoredView = null;
|
|
if (ship != Ship)
|
|
{
|
|
ShowFleetArrivalNotice($"{ship.Name} is waiting for you at the {Market.Ports[passage.Voyage.Destination].Name} channel entrance.", false);
|
|
return;
|
|
}
|
|
|
|
passageSpeed = 1;
|
|
ResetShorePlanning();
|
|
passageAudio.AnnounceApproach();
|
|
FocusDockManeuver(passage.Dock);
|
|
Save();
|
|
Render();
|
|
}
|
|
|
|
private void UpdateActiveDockManeuver(DockManeuver dock, float delta)
|
|
{
|
|
if (fleetOpen)
|
|
{
|
|
SetPassageFreeLook(false);
|
|
return;
|
|
}
|
|
|
|
UpdateDockManeuverControls(delta);
|
|
if (ActiveDockManeuver != dock)
|
|
return;
|
|
|
|
UpdatePassageCameraLook(delta);
|
|
harbor.PresentDockManeuver(dock, delta);
|
|
DisplayDockInstruments(dock);
|
|
harbor.UpdatePassengers(livePassage, delta);
|
|
UpdateAnnouncement();
|
|
UpdatePilotageGuide(dock);
|
|
if (dock.Arriving && dock.Secured)
|
|
FinishVoyage();
|
|
}
|
|
|
|
private void EngageDockAutopilot()
|
|
{
|
|
if (paused || fleetOpen || ActiveDockManeuver is not { Arriving: false, ReadyForAutopilot: true } dock)
|
|
return;
|
|
|
|
FleetPassage passage = fleetPassages[Ship];
|
|
passage.Dock = null;
|
|
StopPilotageGuide();
|
|
passageHelm.TakeDepartureSpeed(dock.SpeedKnots);
|
|
harbor.PresentDockBridge(null, 0, false);
|
|
harbor.EndDockManeuver();
|
|
harbor.BeginPassage(underway.Weather, PassageDuration(underway));
|
|
PresentVessel(0);
|
|
if (passageBridge)
|
|
harbor.ViewBridge();
|
|
passageAudio.Announce(PassageAnnouncement.Departure);
|
|
Save();
|
|
Render();
|
|
}
|
|
|
|
private void ShowDockBridge()
|
|
{
|
|
if (ActiveDockManeuver == null)
|
|
return;
|
|
passageBridge = true;
|
|
harbor.ViewBridge();
|
|
DisplayDockInstruments(ActiveDockManeuver);
|
|
Render();
|
|
}
|
|
|
|
private void ShowDockExterior()
|
|
{
|
|
if (ActiveDockManeuver == null)
|
|
return;
|
|
passageBridge = false;
|
|
harbor.ShowDeck(-1);
|
|
harbor.PresentDockBridge(null, 0, false);
|
|
harbor.ResetView(true);
|
|
Render();
|
|
}
|
|
|
|
private void DisplayDockInstruments(DockManeuver dock)
|
|
{
|
|
if (!passageBridge || dock == null)
|
|
return;
|
|
FleetPassage passage = fleetPassages[Ship];
|
|
harbor.PresentDockBridge(dock, DockRadarRanges[passage.DockRadarRange], passage.DockRadarNorthUp);
|
|
}
|
|
|
|
private void CycleDockRadarRange()
|
|
{
|
|
if (ActiveDockManeuver == null || !DockRadarAvailable)
|
|
return;
|
|
FleetPassage passage = fleetPassages[Ship];
|
|
passage.DockRadarRange = (passage.DockRadarRange + 1) % DockRadarRanges.Length;
|
|
DisplayDockInstruments(passage.Dock);
|
|
}
|
|
|
|
private void ToggleDockRadarOrientation()
|
|
{
|
|
if (ActiveDockManeuver == null || !DockAdvancedRadarAvailable)
|
|
return;
|
|
FleetPassage passage = fleetPassages[Ship];
|
|
passage.DockRadarNorthUp = !passage.DockRadarNorthUp;
|
|
DisplayDockInstruments(passage.Dock);
|
|
}
|
|
}
|
|
}
|