Color Persistence for Nightly Games (#881)

Added color persistence between game switches for most of the games in the nightly that needed it:
- Basketball Girls
- Bouncy Road
- Chameleon
- Clap Trap
- Fillbots
- Frog Princess
- Sick Beats
- Sumo Brothers

Slot Monster has none yet, because its color changing is a little different lol
This commit is contained in:
wookywok
2024-04-19 14:16:16 -05:00
committed by GitHub
parent 973f5f18ee
commit 37ebc3c9af
8 changed files with 166 additions and 0 deletions

View File

@ -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"]);
}
}
}
}