Background Color Change Parity (#530)

* coin toss to see saw

* all done

* more stuffs
This commit is contained in:
Rapandrasmus
2023-08-12 05:30:03 +02:00
committed by GitHub
parent cd94ee3761
commit 74359d3e1c
13 changed files with 655 additions and 318 deletions

View File

@ -203,6 +203,27 @@ namespace HeavenStudio.Games
UpdateColors();
}
private void PersistColors(double beat)
{
var allEventsBeforeBeat = EventCaller.GetAllInGameManagerList("builtToScaleDS", new string[] { "color" }).FindAll(x => x.beat < beat);
if (allEventsBeforeBeat.Count > 0)
{
allEventsBeforeBeat.Sort((x, y) => x.beat.CompareTo(y.beat));
var lastEvent = allEventsBeforeBeat[^1];
UpdateMappingColors(lastEvent["object"], lastEvent["shooter"], lastEvent["bg"]);
}
}
public override void OnGameSwitch(double beat)
{
PersistColors(beat);
}
public override void OnPlay(double beat)
{
PersistColors(beat);
}
private void UpdateColors()
{
objectMaterial.SetColor("_Color", currentObjectColor);