diff --git a/Assets/Scripts/Games/Lockstep/Lockstep.cs b/Assets/Scripts/Games/Lockstep/Lockstep.cs index d6f0fcb4..6fd96aa3 100644 --- a/Assets/Scripts/Games/Lockstep/Lockstep.cs +++ b/Assets/Scripts/Games/Lockstep/Lockstep.cs @@ -291,7 +291,7 @@ namespace HeavenStudio.Games private void PersistColors(double beat) { - var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("lockstep", new string[] { "" }).FindAll(x => x.beat < beat); + var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("lockstep", new string[] { "set colours" }).FindAll(x => x.beat < beat); if (allEventsBeforeBeat.Count > 0) { allEventsBeforeBeat.Sort((x, y) => x.beat.CompareTo(y.beat)); @@ -307,14 +307,15 @@ namespace HeavenStudio.Games public override void OnGameSwitch(double beat) { QueueSwitchBGs(beat); - PersistColors(beat); + } public override void OnPlay(double beat) { + queuedInputs.Clear(); QueueSwitchBGs(beat); - PersistColors(beat); + } private void QueueSwitchBGs(double beat) @@ -346,6 +347,9 @@ namespace HeavenStudio.Games stepperMaterial.SetColor("_ColorBravo", stepperDark); stepperMaterial.SetColor("_ColorDelta", stepperLight); + EntityPreCheck(Conductor.instance.songPositionInBeatsAsDouble); + + masterSprite = masterStepperSprite.sprite; stepswitcherLeft.gameObject.SetActive(lessSteppers); stepswitcherRight.gameObject.SetActive(lessSteppers); @@ -358,6 +362,11 @@ namespace HeavenStudio.Games cameraDV.Render(); } + void EntityPreCheck(double beat) + { + PersistColors(beat); + } + void UpdateAndRenderSlaves() { foreach (var stepper in slaveSteppers) diff --git a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs index 1f14665f..e7179b23 100644 --- a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs +++ b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs @@ -194,8 +194,15 @@ namespace HeavenStudio.Games } } + public override void OnPlay(double beat) + { + PersistColor(beat); + } + + public override void OnGameSwitch(double beat) { + PersistColor(beat); List prevEntities = GameManager.instance.Beatmap.Entities.FindAll(c => c.beat <= beat && c.datamodel.Split(0) == "mrUpbeat"); if (beat >= startBlippingBeat) @@ -410,5 +417,25 @@ namespace HeavenStudio.Games } public void Nothing(PlayerActionEvent caller) { } + + private void PersistColor(double beat) + { + var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("mrUpbeat", new string[] { "changeBG" }).FindAll(x => x.beat < beat); + if (allEventsBeforeBeat.Count > 0) + { + allEventsBeforeBeat.Sort((x, y) => x.beat.CompareTo(y.beat)); //just in case + var lastEvent = allEventsBeforeBeat[^1]; + BackgroundColor(lastEvent.beat, lastEvent.length, lastEvent["start"], lastEvent["end"], lastEvent["ease"]); + } + + var allEventsBeforeBeatObj = EventCaller.GetAllInGameManagerList("mrUpbeat", new string[] { "upbeatColors" }).FindAll(x => x.beat < beat); + if (allEventsBeforeBeatObj.Count > 0) + { + allEventsBeforeBeatObj.Sort((x, y) => x.beat.CompareTo(y.beat)); //just in case + var lastEventObj = allEventsBeforeBeatObj[^1]; + UpbeatColors(lastEventObj["blipColor"], lastEventObj["setShadow"], lastEventObj["shadowColor"]); + } + } + } } \ No newline at end of file