From 370f08648cff13f946ff30a84842abfe6e9dd9b9 Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Fri, 24 Nov 2023 19:59:01 +0100 Subject: [PATCH] splashdown spawn tweaked --- Assets/Scripts/Games/AirRally/AirRally.cs | 4 +-- .../Scripts/Games/Splashdown/NtrSynchrette.cs | 4 +-- Assets/Scripts/Games/Splashdown/Splashdown.cs | 26 ++++++++++++++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/Games/AirRally/AirRally.cs b/Assets/Scripts/Games/AirRally/AirRally.cs index ee3878941..dcc8cbea4 100644 --- a/Assets/Scripts/Games/AirRally/AirRally.cs +++ b/Assets/Scripts/Games/AirRally/AirRally.cs @@ -1049,11 +1049,11 @@ namespace HeavenStudio.Games SetDistance(distanceEvent.beat, distanceEvent["type"], distanceEvent["ease"]); } - if (wantStartRally >= beat && IsRallyBeat(wantStartRally)) + if (wantStartRally >= beat && IsRallyBeat(wantStartRally) && wantStartRally < nextGameSwitchBeatGlobal) { StartRally(wantStartRally); } - else if (wantStartBaBum >= beat && IsBaBumBeat(wantStartBaBum)) + else if (wantStartBaBum >= beat && IsBaBumBeat(wantStartBaBum) && wantStartBaBum < nextGameSwitchBeatGlobal) { StartBaBumBumBum(wantStartBaBum, wantCount, wantAlt); } diff --git a/Assets/Scripts/Games/Splashdown/NtrSynchrette.cs b/Assets/Scripts/Games/Splashdown/NtrSynchrette.cs index bccc661a5..484a049ab 100644 --- a/Assets/Scripts/Games/Splashdown/NtrSynchrette.cs +++ b/Assets/Scripts/Games/Splashdown/NtrSynchrette.cs @@ -124,10 +124,10 @@ namespace HeavenStudio.Games.Scripts_Splashdown Instantiate(splashPrefab, splashHolder).Init("Appearsplash"); } - public void GoDown() + public void GoDown(bool splash = true) { SetState(MovementState.Dive, startBeat); - Instantiate(splashPrefab, splashHolder).Init("GodownSplash"); + if (splash) Instantiate(splashPrefab, splashHolder).Init("GodownSplash"); } public void Bop() diff --git a/Assets/Scripts/Games/Splashdown/Splashdown.cs b/Assets/Scripts/Games/Splashdown/Splashdown.cs index 70f33da75..5cac91776 100644 --- a/Assets/Scripts/Games/Splashdown/Splashdown.cs +++ b/Assets/Scripts/Games/Splashdown/Splashdown.cs @@ -65,7 +65,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("amount", "Synchrette Amount") { - function = delegate { Splashdown.instance.SpawnSynchrettes(eventCaller.currentEntity["amount"]); }, + function = delegate { Splashdown.instance.SpawnSynchrettes(eventCaller.currentEntity["amount"], eventCaller.currentEntity.beat); }, defaultLength = 0.5f, parameters = new List() { @@ -93,6 +93,7 @@ namespace HeavenStudio.Games private List currentSynchrettes = new List(); private NtrSynchrette player; + private double _gameSwitchBeat = -1; private void Awake() { @@ -100,6 +101,18 @@ namespace HeavenStudio.Games SpawnSynchrettes(3); } + public override void OnGameSwitch(double beat) + { + _gameSwitchBeat = beat; + } + + public override void OnPlay(double beat) + { + var events = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame" }).FindAll(x => x.beat < beat); + if (events.Count == 0) return; + _gameSwitchBeat = events[^1].beat; + } + private void Update() { var cond = Conductor.instance; @@ -125,7 +138,7 @@ namespace HeavenStudio.Games } } - public void SpawnSynchrettes(int amount) + public void SpawnSynchrettes(int amount, double beat = -1) { if (currentSynchrettes.Count > 0) { @@ -137,13 +150,20 @@ namespace HeavenStudio.Games } if (player != null) Destroy(player.gameObject); float startPos = -((amount / 2) * synchretteDistance) + ((amount % 2 == 0) ? synchretteDistance / 2 : 0); - + bool shouldGoDown = false; + if (beat >= 0) + { + var inputEvents = EventCaller.GetAllInGameManagerList("splashdown", new string[] { "dive", "appear", "jump", "together", "togetherR9" }).FindAll(x => x.beat < beat && x.beat >= _gameSwitchBeat); + if (inputEvents.Count > 0) shouldGoDown = inputEvents[^1].datamodel == "splashdown/dive"; + } for (int i = 0; i < amount; i++) { NtrSynchrette spawnedSynchrette = Instantiate(synchrettePrefab, synchretteHolder); spawnedSynchrette.transform.localPosition = new Vector3(startPos + (synchretteDistance * i), spawnedSynchrette.transform.localPosition.y, 0); if (i < amount - 1) currentSynchrettes.Add(spawnedSynchrette); else player = spawnedSynchrette; + + if (shouldGoDown) spawnedSynchrette.GoDown(false); } }