ColorEase Class (#735)

* ColorEase stuff

why didn't we do this earlier!! this is so much common code cut down and makes things a LOT easier to type

* port karate man, fix NaN bug

goin to bed now!

* km fix, convert all to colorease, multisounds stuff

fix that goddamn ms.startBeat = sounds[0].beat; bug + if it's already converting to a list, why not just define the sounds as a list??????? they're a list most of the time anyways

ive got work ahead of me.

* finish up the code, document it

just a few more fixes and we're good

* revert some fork lifter stuff

as nice as it would be i just don't want things to break

* revert some MORE stuff

* revert even more. bleh

* semtiones lol

also a karate man fix
This commit is contained in:
AstrlJelly
2024-03-03 22:50:46 -05:00
committed by minenice55
parent 3c19507016
commit 56789add20
15 changed files with 229 additions and 500 deletions

View File

@ -479,33 +479,17 @@ namespace HeavenStudio.Games
player.canClap = true;
}
private double colorStartBeat = -1;
private float colorLength = 0f;
private Color colorStart = Color.white; //obviously put to the default color of the game
private Color colorEnd = Color.white;
private Util.EasingFunction.Ease colorEase; //putting Util in case this game is using jukebox
private ColorEase bgColorEase = new(Color.white);
//call this in update
private void BackgroundColorUpdate()
{
float normalizedBeat = Mathf.Clamp01(Conductor.instance.GetPositionFromBeat(colorStartBeat, colorLength));
var func = Util.EasingFunction.GetEasingFunction(colorEase);
float newR = func(colorStart.r, colorEnd.r, normalizedBeat);
float newG = func(colorStart.g, colorEnd.g, normalizedBeat);
float newB = func(colorStart.b, colorEnd.b, normalizedBeat);
background.color = new Color(newR, newG, newB);
background.color = bgColorEase.GetColor();
}
public void BackgroundColor(double beat, float length, Color colorStartSet, Color colorEndSet, int ease)
{
colorStartBeat = beat;
colorLength = length;
colorStart = colorStartSet;
colorEnd = colorEndSet;
colorEase = (Util.EasingFunction.Ease)ease;
bgColorEase = new ColorEase(beat, length, colorStartSet, colorEndSet, ease);
}
//call this in OnPlay(double beat) and OnGameSwitch(double beat)