Unlock expanded venues and manage concurrent fleet voyages
This commit is contained in:
@@ -17,20 +17,25 @@ namespace Soundings
|
||||
if (root == null)
|
||||
return;
|
||||
|
||||
float delta = Time.unscaledDeltaTime;
|
||||
if (harbor.PortCinematicActive)
|
||||
{
|
||||
if (!paused)
|
||||
UpdateBackgroundPassages(delta);
|
||||
if (holdCinematicClock)
|
||||
return;
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
EndPortCinematic();
|
||||
else
|
||||
UpdatePortCinematic(Time.unscaledDeltaTime);
|
||||
UpdatePortCinematic(delta);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
if (!paused && underway != null && voyageMapOpen)
|
||||
if (!paused && fleetOpen)
|
||||
ToggleFleetOverview();
|
||||
else if (!paused && underway != null && voyageMapOpen)
|
||||
ToggleVoyageMap();
|
||||
else if (title && pendingStart.HasValue)
|
||||
{
|
||||
@@ -44,18 +49,25 @@ namespace Soundings
|
||||
}
|
||||
}
|
||||
|
||||
passageAudio.Mix(Time.unscaledDeltaTime, underway != null && !paused,
|
||||
if (!paused && !title)
|
||||
{
|
||||
if (!EditingText() && Input.GetKeyDown(KeyCode.F2))
|
||||
ToggleFleetOverview();
|
||||
UpdateBackgroundPassages(delta);
|
||||
}
|
||||
|
||||
passageAudio.Mix(delta, underway != null && !paused,
|
||||
passageHelm?.Speed ?? 0, underway?.Weather ?? WeatherCondition.Calm,
|
||||
passageBridge || passageExploring, passageServiceArea == 0);
|
||||
|
||||
if (underway != null)
|
||||
{
|
||||
if (!paused)
|
||||
UpdateActivePassage();
|
||||
UpdateActivePassage(delta);
|
||||
return;
|
||||
}
|
||||
|
||||
if (title || paused || EditingText())
|
||||
if (title || paused || fleetOpen || EditingText())
|
||||
return;
|
||||
|
||||
for (int i = 0; i < HotbarPages.Length; i++)
|
||||
@@ -69,26 +81,21 @@ namespace Soundings
|
||||
if (page == 0 && Input.GetKeyDown(KeyCode.Home))
|
||||
harbor.ResetView();
|
||||
if (page == 0)
|
||||
TurnPassageCamera(Time.unscaledDeltaTime);
|
||||
TurnPassageCamera(delta);
|
||||
}
|
||||
|
||||
private void UpdateActivePassage()
|
||||
private void UpdateActivePassage(float delta)
|
||||
{
|
||||
float delta = Time.unscaledDeltaTime;
|
||||
if (Input.GetKeyDown(KeyCode.M))
|
||||
ToggleVoyageMap();
|
||||
if (Input.GetKeyDown(KeyCode.H) && (passageBridge || passageHelm.Manual))
|
||||
ToggleHelm();
|
||||
|
||||
float rudder = 0;
|
||||
if (passageHelm.Manual)
|
||||
if (fleetOpen)
|
||||
{
|
||||
rudder = MoveAxis(KeyCode.D, KeyCode.A);
|
||||
if (Input.GetKeyDown(KeyCode.W))
|
||||
SetHelmOrder(HelmOrder + 1);
|
||||
if (Input.GetKeyDown(KeyCode.S))
|
||||
SetHelmOrder(HelmOrder - 1);
|
||||
SetPassageFreeLook(false);
|
||||
if (passageHelm.Manual)
|
||||
ReleaseHelm();
|
||||
}
|
||||
else
|
||||
rudder = ReadNavigationControls();
|
||||
|
||||
passageHelm.Advance(delta * passageSpeed, rudder, livePassage.SpeedFactor, underway.Weather);
|
||||
float progress = passageHelm.Progress;
|
||||
UpdatePortApproach();
|
||||
@@ -104,6 +111,36 @@ namespace Soundings
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fleetOpen)
|
||||
UpdatePassageView(delta);
|
||||
|
||||
UpdatePassageUi(progress);
|
||||
UpdateServiceNavigation();
|
||||
UpdateHelmControls();
|
||||
UpdateStationInteractions();
|
||||
UpdateAnnouncement();
|
||||
UpdateVoyageMap();
|
||||
}
|
||||
|
||||
private float ReadNavigationControls()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.M))
|
||||
ToggleVoyageMap();
|
||||
if (Input.GetKeyDown(KeyCode.H) && (passageBridge || passageHelm.Manual))
|
||||
ToggleHelm();
|
||||
|
||||
if (!passageHelm.Manual)
|
||||
return 0;
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.W))
|
||||
SetHelmOrder(HelmOrder + 1);
|
||||
if (Input.GetKeyDown(KeyCode.S))
|
||||
SetHelmOrder(HelmOrder - 1);
|
||||
return MoveAxis(KeyCode.D, KeyCode.A);
|
||||
}
|
||||
|
||||
private void UpdatePassageView(float delta)
|
||||
{
|
||||
if (!Input.GetMouseButton(1) || !Application.isFocused)
|
||||
SetPassageFreeLook(false);
|
||||
if (passageFreeLook && passageCursorLocked)
|
||||
@@ -150,12 +187,6 @@ namespace Soundings
|
||||
break;
|
||||
}
|
||||
}
|
||||
UpdatePassageUi(progress);
|
||||
UpdateServiceNavigation();
|
||||
UpdateHelmControls();
|
||||
UpdateStationInteractions();
|
||||
UpdateAnnouncement();
|
||||
UpdateVoyageMap();
|
||||
}
|
||||
|
||||
private void UpdatePortApproach()
|
||||
@@ -198,7 +229,7 @@ namespace Soundings
|
||||
private static float PassageDuration(Voyage voyage)
|
||||
{
|
||||
float weather = voyage.Weather switch { WeatherCondition.Swell => 1.14f, WeatherCondition.Storm => 1.32f, _ => 1 };
|
||||
return Mathf.Clamp((90f + voyage.Miles * .125f + voyage.Days * 6f) * weather, 115f, 360f);
|
||||
return Mathf.Clamp((135f + voyage.Miles * .18f + voyage.Days * 8f) * weather, 175f, 540f);
|
||||
}
|
||||
|
||||
private bool EditingText()
|
||||
@@ -212,7 +243,7 @@ namespace Soundings
|
||||
private void BeginVoyage(Voyage quote)
|
||||
{
|
||||
Ship ship = Ship;
|
||||
if (underway != null || ship == null)
|
||||
if (underway != null || ship == null || fleetPassages.ContainsKey(ship))
|
||||
return;
|
||||
string failure = company.DepartureBlock(ship, quote);
|
||||
if (failure != null)
|
||||
@@ -221,23 +252,13 @@ namespace Soundings
|
||||
return;
|
||||
}
|
||||
|
||||
underway = quote;
|
||||
livePassage = new OnboardSession(ship, quote) { Assisted = company.Voyages < 3 && ship.HullIndex == 0 };
|
||||
passageHelm = new HelmNavigation(PassageDuration(quote), ship.HullIndex);
|
||||
passageSpeed = 1;
|
||||
passageDeck = passageServiceArea = -1;
|
||||
passageBridge = passageExploring = false;
|
||||
voyageMapOpen = false;
|
||||
stationFeedbackText = null;
|
||||
passageBusinessOpen = true;
|
||||
SetPassageFreeLook(false);
|
||||
var passage = new FleetPassage(ship, quote, company.Voyages < 3 && ship.HullIndex == 0);
|
||||
fleetPassages.Add(ship, passage);
|
||||
UpdateVoyageReserves();
|
||||
fleetOpen = shipActionsOpen = false;
|
||||
page = 0;
|
||||
Notify(null);
|
||||
harbor.BeginPassage(quote.Weather, PassageDuration(quote));
|
||||
harbor.ShowDeck(passageDeck);
|
||||
harbor.UpdatePassengers(livePassage, 0);
|
||||
passageAudio.Begin(quote.Destination);
|
||||
FocusPassage(passage, true);
|
||||
if (!StartPortCinematic(quote.Origin, false))
|
||||
Render();
|
||||
}
|
||||
@@ -304,6 +325,8 @@ namespace Soundings
|
||||
if (underway == null || (speed != 1 && speed != 2 && speed != 4) || speed == passageSpeed)
|
||||
return;
|
||||
passageSpeed = speed;
|
||||
if (fleetPassages.TryGetValue(Ship, out FleetPassage passage))
|
||||
passage.Speed = speed;
|
||||
Render();
|
||||
}
|
||||
|
||||
@@ -312,8 +335,7 @@ namespace Soundings
|
||||
if (underway == null || paused || harbor.PortCinematicActive)
|
||||
return;
|
||||
Voyage voyage = underway;
|
||||
livePassage.AdvanceTo(1);
|
||||
string failure = company.Sail(Ship, voyage.Destination, livePassage);
|
||||
string failure = SettleFleetPassage(Ship, livePassage);
|
||||
if (failure != null)
|
||||
{
|
||||
Notify(failure, true);
|
||||
@@ -334,6 +356,11 @@ namespace Soundings
|
||||
: " Itinerary complete.";
|
||||
Notify(arrival);
|
||||
Save();
|
||||
if (fleetOpen)
|
||||
{
|
||||
CompleteDocking();
|
||||
return;
|
||||
}
|
||||
passageAudio.AnnounceApproach();
|
||||
if (!StartPortCinematic(voyage.Destination, true))
|
||||
CompleteDocking();
|
||||
@@ -341,14 +368,8 @@ namespace Soundings
|
||||
|
||||
private void CompleteDocking()
|
||||
{
|
||||
underway = null;
|
||||
livePassage = null;
|
||||
passageHelm = null;
|
||||
passageServiceArea = -1;
|
||||
voyageMapOpen = false;
|
||||
ClearActivePassage();
|
||||
passageAudio.End();
|
||||
serviceReadout = null;
|
||||
SetPassageFreeLook(false);
|
||||
harbor.EndPassage();
|
||||
Render();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user