yeah that's about it (#591)

works perfectly, looks better, easier to type, and more efficient. what's there to hate
This commit is contained in:
AstrlJelly 2023-12-05 20:59:36 -05:00 committed by GitHub
parent d7c6533f61
commit 87653b0d65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 27 additions and 37 deletions

View file

@ -58,7 +58,7 @@ namespace HeavenStudio.Games.Scripts_GleeClub
public void MissPose()
{
if (!singing && anim.GetCurrentAnimatorStateInfo(0).IsName("Idle") && !anim.IsPlayingAnimationName("MissIdle")) anim.Play("MissIdle", 0, 0);
if (!singing && anim.GetCurrentAnimatorStateInfo(0).IsName("Idle") && !anim.IsPlayingAnimationNames("MissIdle")) anim.Play("MissIdle", 0, 0);
}
public void StartCrouch()

View file

@ -37,7 +37,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
SoundByte.PlayOneShotGame("launchParty/miss");
SoundByte.PlayOneShotGame("launchParty/rocket_endBad");
string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right";
if (!anim.IsPlayingAnimationName("RocketBarelyLeft") && !anim.IsPlayingAnimationName("RocketBarelyRight")) anim.Play("RocketBarely" + leftOrRight, 0, 0);
if (!anim.IsPlayingAnimationNames("RocketBarelyLeft", "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 (anim.IsPlayingAnimationName("RocketBarelyLeft") || anim.IsPlayingAnimationName("RocketBarelyRight"))
if (anim.IsPlayingAnimationNames("RocketBarelyLeft", "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 (anim.IsPlayingAnimationName("RocketBarelyLeft") || anim.IsPlayingAnimationName("RocketBarelyRight"))
if (anim.IsPlayingAnimationNames("RocketBarelyLeft", "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 (anim.IsPlayingAnimationName("RocketBarelyLeft") || anim.IsPlayingAnimationName("RocketBarelyRight"))
if (anim.IsPlayingAnimationNames("RocketBarelyLeft", "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 (anim.IsPlayingAnimationName("RocketBarelyLeft") || anim.IsPlayingAnimationName("RocketBarelyRight"))
if (anim.IsPlayingAnimationNames("RocketBarelyLeft", "RocketBarelyRight"))
{
number.SetActive(false);
anim.SetBool("CanRise", false);

View file

@ -158,8 +158,8 @@ namespace HeavenStudio.Games
public override void OnBeatPulse(double beat)
{
if (!BossAnim.IsPlayingAnimationName("BossCall")
&& !BossAnim.IsPlayingAnimationName("BossSignal")
if (!BossAnim.IsPlayingAnimationNames("BossCall")
&& !BossAnim.IsPlayingAnimationNames("BossSignal")
&& BeatIsInBopRegion(beat))
{
BossAnim.DoScaledAnimationAsync(bossAnnoyed ? "BossMiss" : "Bop", 0.5f);
@ -174,7 +174,7 @@ namespace HeavenStudio.Games
{
BeatAction.New(instance, new List<BeatAction.Action>() {
new BeatAction.Action(beat + i, delegate {
if (!BossAnim.IsPlayingAnimationName("BossCall") && !BossAnim.IsPlayingAnimationName("BossSignal")) {
if (!BossAnim.IsPlayingAnimationNames("BossCall") && !BossAnim.IsPlayingAnimationNames("BossSignal")) {
BossAnim.DoScaledAnimationAsync(bossAnnoyed ? "BossMiss" : "Bop", 0.5f);
}
})

View file

@ -38,7 +38,7 @@ namespace HeavenStudio.Games.Scripts_MeatGrinder
private void Update()
{
if (anim.IsPlayingAnimationName("DarkIdle") || anim.IsPlayingAnimationName("LightIdle")) GameObject.Destroy(gameObject);
if (anim.IsPlayingAnimationNames("DarkIdle") || anim.IsPlayingAnimationNames("LightIdle")) GameObject.Destroy(gameObject);
}
private void InputActions(bool annoyBoss, string whichSfx, string whichAnim)

View file

@ -287,13 +287,10 @@ namespace HeavenStudio.Games
}
// blushes when done eating but not when staring
if (needBlush
&& !MonkAnim.IsPlayingAnimationName("Eat")
&& !MonkAnim.IsPlayingAnimationName("Stare")
&& !MonkAnim.IsPlayingAnimationName("Barely")
&& !MonkAnim.IsPlayingAnimationName("Miss")
if (needBlush
&& !MonkAnim.IsPlayingAnimationNames("Eat", "Stare", "Barely", "Miss")
&& !isStaring
&& !noBlush)
&& !noBlush)
{
MonkAnim.DoScaledAnimationAsync("Blush", 0.5f);
needBlush = false;
@ -351,14 +348,14 @@ namespace HeavenStudio.Games
public override void OnBeatPulse(double beat)
{
if ((MonkAnim.IsAnimationNotPlaying() || MonkAnim.IsPlayingAnimationName("Bop") || MonkAnim.IsPlayingAnimationName("Idle"))
if ((MonkAnim.IsAnimationNotPlaying() || MonkAnim.IsPlayingAnimationNames("Bop", "Idle"))
&& BeatIsInBopRegion(beat)
&& !isStaring)
{
MonkAnim.DoScaledAnimationAsync("Bop", 0.5f);
}
if (!MonkAnim.IsPlayingAnimationName("Blush") || !MonkAnim.IsPlayingAnimationName("Stare"))
if (!MonkAnim.IsPlayingAnimationNames("Blush", "Stare"))
{
if (growLevel == 4) BrowAnim.DoScaledAnimationAsync("Bop", 0.5f);
if (growLevel > 0) StacheAnim.DoScaledAnimationAsync($"Bop{growLevel}", 0.5f);

View file

@ -31,7 +31,7 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine
void Update()
{
if (queuePrepare <= Conductor.instance.songPositionInBeatsAsDouble && Conductor.instance.NotStopped()) {
if (!(isPreparing || isSqueezed || anim.IsPlayingAnimationName("Release") || anim.IsPlayingAnimationName("Pop")))
if (!(isPreparing || isSqueezed || anim.IsPlayingAnimationNames("Release", "Pop")))
{
anim.DoScaledAnimationFromBeatAsync("Prepare", 0.5f, queuePrepare);
isPreparing = true;
@ -66,15 +66,7 @@ namespace HeavenStudio.Games.Scripts_OctopusMachine
public void RequestBop()
{
if (!anim.IsPlayingAnimationName("Bop")
&& !anim.IsPlayingAnimationName("Happy")
&& !anim.IsPlayingAnimationName("Angry")
&& !anim.IsPlayingAnimationName("Oops")
&& !anim.IsPlayingAnimationName("Release")
&& !anim.IsPlayingAnimationName("Pop")
&& !isPreparing
&& !isSqueezed
&& !cantBop)
if (!anim.IsPlayingAnimationNames("Bop", "Happy", "Angry", "Oops", "Release", "Pop") && !isPreparing && !isSqueezed && !cantBop)
{
PlayAnimation(game.bopStatus);
}

View file

@ -248,7 +248,7 @@ namespace HeavenStudio.Games
wrestlerAnim.DoScaledAnimationAsync("YeMiss", 0.25f);
SoundByte.PlayOneShotGame($"ringside/confusedanswer");
if (reporterAnim.IsPlayingAnimationName("IdleReporter")) reporterAnim.Play("IdleLate", 0, 0);
if (reporterAnim.IsPlayingAnimationNames("IdleReporter")) reporterAnim.Play("IdleLate", 0, 0);
}
}
if ( PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch

View file

@ -266,7 +266,7 @@ namespace HeavenStudio.Games
}
}
}
if (!DancerP.IsPlayingAnimationName("PunchDo") && !DancerP.IsPlayingAnimationName("TurnRightDo") && !DancerP.IsPlayingAnimationName("SitDownDo"))
if (!DancerP.IsPlayingAnimationNames("PunchDo", "TurnRightDo", "SitDownDo"))
{
if (PlayerInput.GetIsAction(InputAction_Punch) && !IsExpectingInputNow(InputAction_Punch))
{

View file

@ -38,7 +38,7 @@ namespace HeavenStudio.Games.Scripts_TapTroupe
public void ResetFace()
{
if (expressionAnim.IsPlayingAnimationName("Okay")) return;
if (expressionAnim.IsPlayingAnimationNames("Okay")) return;
expressionAnim.Play("NoExpression", 0, 0);
}

View file

@ -30,7 +30,7 @@ namespace HeavenStudio.Games.Scripts_TossBoys
spawnedEffect.Play();
DoAnimationScaledAsync(crouch ? "CrouchHit" : "Hit", 0.5f);
}
else if (!anim.IsPlayingAnimationName(prefix + "Whiff") && !anim.IsPlayingAnimationName(prefix + "Miss"))
else if (!anim.IsPlayingAnimationNames(prefix + "Whiff", prefix + "Miss"))
{
DoAnimationScaledAsync("Whiff", 0.5f);
SoundByte.PlayOneShotGame("tossBoys/whiff");
@ -40,7 +40,7 @@ namespace HeavenStudio.Games.Scripts_TossBoys
public void Bop()
{
if (crouch || preparing || (!anim.IsAnimationNotPlaying() && !anim.IsPlayingAnimationName(prefix + "Idle"))) return;
if (crouch || preparing || (!anim.IsAnimationNotPlaying() && !anim.IsPlayingAnimationNames(prefix + "Idle"))) return;
DoAnimationScaledAsync("Bop", 0.5f);
}

View file

@ -312,7 +312,7 @@ namespace HeavenStudio.Games
{
NPCBallTransporters.GetComponent<Animator>().Play("NPCGoBigMode", 0, 0);
}
if (!instance.ballTransporterLeftNPC.GetComponent<Animator>().IsPlayingAnimationName("BallTransporterLeftOpened"))
if (!instance.ballTransporterLeftNPC.GetComponent<Animator>().IsPlayingAnimationNames("BallTransporterLeftOpened"))
{
instance.ballTransporterLeftNPC.GetComponent<Animator>().Play("BallTransporterLeftOpen", 0, 0);
instance.ballTransporterRightNPC.GetComponent<Animator>().Play("BallTransporterRightOpen", 0, 0);

View file

@ -14,11 +14,12 @@ namespace HeavenStudio.Util
/// Returns true if animName is currently playing on animator
/// </summary>
/// <param name="anim">Animator to check</param>
/// <param name="animName">name of animation to look out for</param>
public static bool IsPlayingAnimationName(this Animator anim, string animName)
/// <param name="animNames">name(s) of animation to look out for</param>
public static bool IsPlayingAnimationNames(this Animator anim, params string[] animNames)
{
var stateInfo = anim.GetCurrentAnimatorStateInfo(0);
return (stateInfo.normalizedTime < stateInfo.speed || stateInfo.loop) && stateInfo.IsName(animName);
var isPlaying = Array.Exists(animNames, animName => stateInfo.IsName(animName));
return (stateInfo.normalizedTime < stateInfo.speed || stateInfo.loop) && isPlaying;
}
/// <summary>