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

@ -37,7 +37,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
Jukebox.PlayOneShotGame("launchParty/miss");
Jukebox.PlayOneShotGame("launchParty/rocket_endBad");
string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right";
if (!isPlaying(anim, "RocketBarelyLeft") && !isPlaying(anim, "RocketBarelyRight")) anim.Play("RocketBarely" + leftOrRight, 0, 0);
if (!anim.IsPlayingAnimationName("RocketBarelyLeft") && !anim.IsPlayingAnimationName("RocketBarelyRight")) anim.Play("RocketBarely" + leftOrRight, 0, 0);
game.ScoreMiss(0.5);
}
}
@ -167,7 +167,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
void JustFamilyRocket(PlayerActionEvent caller, float state)
{
noInput = true;
if (isPlaying(anim, "RocketBarelyLeft") || isPlaying(anim, "RocketBarelyRight"))
if (anim.IsPlayingAnimationName("RocketBarelyLeft") || anim.IsPlayingAnimationName("RocketBarelyRight"))
{
number.SetActive(false);
anim.SetBool("CanRise", false);
@ -213,7 +213,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
void JustPartyCracker(PlayerActionEvent caller, float state)
{
noInput = true;
if (isPlaying(anim, "RocketBarelyLeft") || isPlaying(anim, "RocketBarelyRight"))
if (anim.IsPlayingAnimationName("RocketBarelyLeft") || anim.IsPlayingAnimationName("RocketBarelyRight"))
{
number.SetActive(false);
anim.SetBool("CanRise", false);
@ -257,7 +257,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
void JustBell(PlayerActionEvent caller, float state)
{
noInput = true;
if (isPlaying(anim, "RocketBarelyLeft") || isPlaying(anim, "RocketBarelyRight"))
if (anim.IsPlayingAnimationName("RocketBarelyLeft") || anim.IsPlayingAnimationName("RocketBarelyRight"))
{
number.SetActive(false);
anim.SetBool("CanRise", false);
@ -301,7 +301,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
void JustBowlingPin(PlayerActionEvent caller, float state)
{
noInput = true;
if (isPlaying(anim, "RocketBarelyLeft") || isPlaying(anim, "RocketBarelyRight"))
if (anim.IsPlayingAnimationName("RocketBarelyLeft") || anim.IsPlayingAnimationName("RocketBarelyRight"))
{
number.SetActive(false);
anim.SetBool("CanRise", false);
@ -355,15 +355,6 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
});
}
bool isPlaying(Animator anim, string stateName)
{
if (anim.GetCurrentAnimatorStateInfo(0).IsName(stateName) &&
anim.GetCurrentAnimatorStateInfo(0).normalizedTime < 1.0f)
return true;
else
return false;
}
void Nothing(PlayerActionEvent caller) {}
}
}