diff --git a/Assets/Scripts/Games/BasketballGirls/BasketballGirls.cs b/Assets/Scripts/Games/BasketballGirls/BasketballGirls.cs index 07c9da30..4e0d1d76 100644 --- a/Assets/Scripts/Games/BasketballGirls/BasketballGirls.cs +++ b/Assets/Scripts/Games/BasketballGirls/BasketballGirls.cs @@ -241,6 +241,28 @@ namespace HeavenStudio.Games { BGPlane.color = bgColorEase.GetColor(); } + + //call this in OnPlay(double beat) and OnGameSwitch(double beat) + private void PersistColor(double beat) + { + var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("basketballGirls", new string[] { "background appearance" }).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]; + BackgroundColorSet(lastEvent.beat, lastEvent.length, lastEvent["colorBGStart"], lastEvent["colorBGEnd"], lastEvent["ease"]); + } + } + + public override void OnPlay(double beat) + { + PersistColor(beat); + } + + public override void OnGameSwitch(double beat) + { + PersistColor(beat); + } } } diff --git a/Assets/Scripts/Games/BouncyRoad/BouncyRoad.cs b/Assets/Scripts/Games/BouncyRoad/BouncyRoad.cs index 0631c6ff..2af35787 100644 --- a/Assets/Scripts/Games/BouncyRoad/BouncyRoad.cs +++ b/Assets/Scripts/Games/BouncyRoad/BouncyRoad.cs @@ -190,6 +190,9 @@ namespace HeavenStudio.Games public override void OnGameSwitch(double beat) { + + PersistColor(beat); + double gameStartBeat = beat, gameEndBeat = double.MaxValue; var firstEnd = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame", "end" }).Find(x => x.beat > gameStartBeat); gameEndBeat = firstEnd?.beat ?? gameEndBeat; @@ -371,5 +374,16 @@ namespace HeavenStudio.Games BGHigh.color = colorEases[0].GetColor(); BGLow.color = colorEases[1].GetColor(); } + + private void PersistColor(double beat) + { + var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("bouncyRoad", new string[] { "background appearance" }).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]; + BackgroundColorSet(lastEvent.beat, lastEvent.length, lastEvent["colorBG1Start"], lastEvent["colorBG1End"], lastEvent["colorBG2Start"], lastEvent["colorBG2End"], lastEvent["ease"]); + } + } } } diff --git a/Assets/Scripts/Games/Chameleon/Chameleon.cs b/Assets/Scripts/Games/Chameleon/Chameleon.cs index c7c4d4a1..b6a28c5f 100644 --- a/Assets/Scripts/Games/Chameleon/Chameleon.cs +++ b/Assets/Scripts/Games/Chameleon/Chameleon.cs @@ -150,6 +150,8 @@ namespace HeavenStudio.Games public override void OnPlay(double beat) { + PersistColor(beat); + if (queuedFlys.Count > 0) queuedFlys.Clear(); foreach (var evt in scheduledInputs) { @@ -296,5 +298,23 @@ namespace HeavenStudio.Games if (GameManager.instance.currentGame == "chameleon") Chameleon.instance.Crown.SetActive(enableCrown); } + + private void PersistColor(double beat) + { + var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("chameleon", new string[] { "background appearance" }).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]; + BackgroundColorSet(lastEvent.beat, lastEvent.length, lastEvent["colorBG1Start"], lastEvent["colorBG1End"], lastEvent["colorBG2Start"], lastEvent["colorBG2End"], lastEvent["ease"]); + } + } + + public override void OnGameSwitch(double beat) + { + PersistColor(beat); + } + + } } \ No newline at end of file diff --git a/Assets/Scripts/Games/ClapTrap/ClapTrap.cs b/Assets/Scripts/Games/ClapTrap/ClapTrap.cs index c04405e4..c70a87f7 100644 --- a/Assets/Scripts/Games/ClapTrap/ClapTrap.cs +++ b/Assets/Scripts/Games/ClapTrap/ClapTrap.cs @@ -380,5 +380,35 @@ namespace HeavenStudio.Games spotlightMaterial.SetColor("_ColorDelta", bottomSpot); } + private void PersistColor(double beat) + { + var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("clapTrap", new string[] { "background color" }).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["bgColor"], lastEvent["bgColorEnd"], lastEvent["ease"], lastEvent.length, lastEvent.beat); + } + + var allEventsBeforeBeatHand = EventCaller.GetAllInGameManagerList("clapTrap", new string[] { "hand color" }).FindAll(x => x.beat < beat); + if (allEventsBeforeBeatHand.Count > 0) + { + allEventsBeforeBeatHand.Sort((x, y) => x.beat.CompareTo(y.beat)); //just in case + var lastEventHand = allEventsBeforeBeatHand[^1]; + ChangeHandColor(lastEventHand["left"], lastEventHand["right"], lastEventHand["spotlightBottom"], lastEventHand["spotlightTop"], lastEventHand["spotlightGlow"]); + } + } + + public override void OnGameSwitch(double beat) + { + PersistColor(beat); + } + + public override void OnPlay(double beat) + { + PersistColor(beat); + } + + } } \ No newline at end of file diff --git a/Assets/Scripts/Games/Fillbots/Fillbots.cs b/Assets/Scripts/Games/Fillbots/Fillbots.cs index 70ee5fe1..618579ec 100644 --- a/Assets/Scripts/Games/Fillbots/Fillbots.cs +++ b/Assets/Scripts/Games/Fillbots/Fillbots.cs @@ -238,6 +238,7 @@ namespace HeavenStudio.Games public override void OnPlay(double beat) { + PersistColor(beat); if (queuedBots.Count > 0) queuedBots.Clear(); foreach (var evt in scheduledInputs) { @@ -548,6 +549,37 @@ namespace HeavenStudio.Games metersFuel[i].color = colorEases[i+1].GetColor(); } } + + private void PersistColor(double beat) + { + var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("fillbots", new string[] { "background appearance" }).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]; + BackgroundColorSet(lastEvent.beat, lastEvent.length, lastEvent["colorBGStart"], lastEvent["colorBGEnd"], lastEvent["colorMetersStart"], + lastEvent["colorMeter1Start"], lastEvent["colorMeter2Start"], + lastEvent["colorMeter3Start"], lastEvent["colorMeter4Start"], + lastEvent["colorMeter5Start"], lastEvent["colorMeter6Start"], + lastEvent["colorMetersEnd"], lastEvent["colorMeter1End"], + lastEvent["colorMeter2End"], lastEvent["colorMeter3End"], + lastEvent["colorMeter4End"], lastEvent["colorMeter5End"], lastEvent["colorMeter6End"], + lastEvent["separate"], lastEvent["ease"]); + } + + var allEventsBeforeBeatObj = EventCaller.GetAllInGameManagerList("fillbots", new string[] { "object appearance" }).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]; + ObjectColorSet(lastEventObj["colorFuel"], lastEventObj["colorLampOff"], lastEventObj["colorLampOn"], lastEventObj["colorImpact"], lastEventObj["colorFiller"], lastEventObj["colorConveyor"]); + } + } + + public override void OnGameSwitch(double beat) + { + PersistColor(beat); + } } } diff --git a/Assets/Scripts/Games/FrogPrincess/FrogPrincess.cs b/Assets/Scripts/Games/FrogPrincess/FrogPrincess.cs index 73f89705..fcd29e39 100644 --- a/Assets/Scripts/Games/FrogPrincess/FrogPrincess.cs +++ b/Assets/Scripts/Games/FrogPrincess/FrogPrincess.cs @@ -379,5 +379,26 @@ namespace HeavenStudio.Games { BGPlane.color = bgColorEase.GetColor(); } + + private void PersistColor(double beat) + { + var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("frogPrincess", new string[] { "background appearance" }).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]; + BackgroundColorSet(lastEvent.beat, lastEvent.length, lastEvent["colorBGStart"], lastEvent["colorBGEnd"], lastEvent["ease"]); + } + } + + public override void OnPlay(double beat) + { + PersistColor(beat); + } + + public override void OnGameSwitch(double beat) + { + PersistColor(beat); + } } } \ No newline at end of file diff --git a/Assets/Scripts/Games/SickBeats/SickBeats.cs b/Assets/Scripts/Games/SickBeats/SickBeats.cs index 11981254..3a17f243 100644 --- a/Assets/Scripts/Games/SickBeats/SickBeats.cs +++ b/Assets/Scripts/Games/SickBeats/SickBeats.cs @@ -237,6 +237,7 @@ namespace HeavenStudio.Games [NonSerialized] public double gameEndBeat = double.MaxValue; public override void OnGameSwitch(double beat) { + PersistColor(beat); var entities = GameManager.instance.Beatmap.Entities; // find out when the next game switch (or remix end) happens RiqEntity firstEnd = entities.Find(c => (c.datamodel.StartsWith("gameManager/switchGame") || c.datamodel.Equals("gameManager/end")) && c.beat > beat); @@ -465,5 +466,16 @@ namespace HeavenStudio.Games return UnityEngine.Random.Range(0, 4); } + + private void PersistColor(double beat) + { + var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("sickBeats", new string[] { "virusColor" }).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]; + UpdateMaterialColor(lastEvent["colorVirus1"], lastEvent["colorVirus2"], lastEvent["colorVirus3"], lastEvent["colorVirus4"]); + } + } } } \ No newline at end of file diff --git a/Assets/Scripts/Games/SumoBrothers/SumoBrothers.cs b/Assets/Scripts/Games/SumoBrothers/SumoBrothers.cs index fc0c6cd2..bf89cee9 100644 --- a/Assets/Scripts/Games/SumoBrothers/SumoBrothers.cs +++ b/Assets/Scripts/Games/SumoBrothers/SumoBrothers.cs @@ -443,6 +443,8 @@ namespace HeavenStudio.Games public override void OnGameSwitch(double beat) // stole code from manzai { FindNextGameswitchBeat(beat); + PersistColor(beat); + foreach(var entity in GameManager.instance.Beatmap.Entities) { @@ -464,6 +466,8 @@ namespace HeavenStudio.Games { bgTypeNext = BGType.None; FindNextGameswitchBeat(beat); + PersistColor(beat); + } private void FindNextGameswitchBeat(double beat) @@ -1306,6 +1310,17 @@ namespace HeavenStudio.Games } } + private void PersistColor(double beat) + { + var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("sumoBrothers", new string[] { "background color" }).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["colorFrom"], lastEvent["colorTo"], lastEvent["colorFrom2"], lastEvent["colorTo2"], lastEvent["ease"]); + } + } + } }