New animation helper function and rhythm rally scaled animations (#285)

This commit is contained in:
Rapandrasmus
2023-02-17 19:45:18 +01:00
committed by GitHub
parent e24bc63760
commit dbe8f7dcf3
7 changed files with 29 additions and 56 deletions

View File

@ -345,7 +345,7 @@ namespace HeavenStudio.Games
{
new BeatAction.Action(spawnBeat, delegate
{
if (!instance.isPlaying(instance.ballTransporterLeftNPC.GetComponent<Animator>(), "BallTransporterLeftOpened") && !instance.intervalStarted && instance.ballTriggerSetInterval)
if (!instance.ballTransporterLeftNPC.GetComponent<Animator>().IsPlayingAnimationName("BallTransporterLeftOpened") && !instance.intervalStarted && instance.ballTriggerSetInterval)
{
instance.ballTransporterLeftNPC.GetComponent<Animator>().Play("BallTransporterLeftOpen", 0, 0);
instance.ballTransporterRightNPC.GetComponent<Animator>().Play("BallTransporterRightOpen", 0, 0);
@ -449,7 +449,7 @@ namespace HeavenStudio.Games
{
new BeatAction.Action(beat, delegate
{
if (!instance.isPlaying(instance.ballTransporterLeftNPC.GetComponent<Animator>(), "BallTransporterLeftOpened"))
if (!instance.ballTransporterLeftNPC.GetComponent<Animator>().IsPlayingAnimationName("BallTransporterLeftOpened"))
{
instance.ballTransporterLeftNPC.GetComponent<Animator>().Play("BallTransporterLeftOpen", 0, 0);
instance.ballTransporterRightNPC.GetComponent<Animator>().Play("BallTransporterRightOpen", 0, 0);
@ -797,15 +797,5 @@ namespace HeavenStudio.Games
}
void Nothing (PlayerActionEvent caller) {}
//Function to make life for my fingers and my and your eyes easier
bool isPlaying(Animator anim, string stateName)
{
if (anim.GetCurrentAnimatorStateInfo(0).IsName(stateName) &&
anim.GetCurrentAnimatorStateInfo(0).normalizedTime < 1.0f)
return true;
else
return false;
}
}
}