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() 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() public void StartCrouch()

View file

@ -37,7 +37,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
SoundByte.PlayOneShotGame("launchParty/miss"); SoundByte.PlayOneShotGame("launchParty/miss");
SoundByte.PlayOneShotGame("launchParty/rocket_endBad"); SoundByte.PlayOneShotGame("launchParty/rocket_endBad");
string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right"; 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); game.ScoreMiss(0.5);
} }
} }
@ -167,7 +167,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
void JustFamilyRocket(PlayerActionEvent caller, float state) void JustFamilyRocket(PlayerActionEvent caller, float state)
{ {
noInput = true; noInput = true;
if (anim.IsPlayingAnimationName("RocketBarelyLeft") || anim.IsPlayingAnimationName("RocketBarelyRight")) if (anim.IsPlayingAnimationNames("RocketBarelyLeft", "RocketBarelyRight"))
{ {
number.SetActive(false); number.SetActive(false);
anim.SetBool("CanRise", false); anim.SetBool("CanRise", false);
@ -213,7 +213,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
void JustPartyCracker(PlayerActionEvent caller, float state) void JustPartyCracker(PlayerActionEvent caller, float state)
{ {
noInput = true; noInput = true;
if (anim.IsPlayingAnimationName("RocketBarelyLeft") || anim.IsPlayingAnimationName("RocketBarelyRight")) if (anim.IsPlayingAnimationNames("RocketBarelyLeft", "RocketBarelyRight"))
{ {
number.SetActive(false); number.SetActive(false);
anim.SetBool("CanRise", false); anim.SetBool("CanRise", false);
@ -257,7 +257,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
void JustBell(PlayerActionEvent caller, float state) void JustBell(PlayerActionEvent caller, float state)
{ {
noInput = true; noInput = true;
if (anim.IsPlayingAnimationName("RocketBarelyLeft") || anim.IsPlayingAnimationName("RocketBarelyRight")) if (anim.IsPlayingAnimationNames("RocketBarelyLeft", "RocketBarelyRight"))
{ {
number.SetActive(false); number.SetActive(false);
anim.SetBool("CanRise", false); anim.SetBool("CanRise", false);
@ -301,7 +301,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
void JustBowlingPin(PlayerActionEvent caller, float state) void JustBowlingPin(PlayerActionEvent caller, float state)
{ {
noInput = true; noInput = true;
if (anim.IsPlayingAnimationName("RocketBarelyLeft") || anim.IsPlayingAnimationName("RocketBarelyRight")) if (anim.IsPlayingAnimationNames("RocketBarelyLeft", "RocketBarelyRight"))
{ {
number.SetActive(false); number.SetActive(false);
anim.SetBool("CanRise", false); anim.SetBool("CanRise", false);

View file

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

View file

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

View file

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

View file

@ -248,7 +248,7 @@ namespace HeavenStudio.Games
wrestlerAnim.DoScaledAnimationAsync("YeMiss", 0.25f); wrestlerAnim.DoScaledAnimationAsync("YeMiss", 0.25f);
SoundByte.PlayOneShotGame($"ringside/confusedanswer"); 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 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)) if (PlayerInput.GetIsAction(InputAction_Punch) && !IsExpectingInputNow(InputAction_Punch))
{ {

View file

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

View file

@ -30,7 +30,7 @@ namespace HeavenStudio.Games.Scripts_TossBoys
spawnedEffect.Play(); spawnedEffect.Play();
DoAnimationScaledAsync(crouch ? "CrouchHit" : "Hit", 0.5f); 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); DoAnimationScaledAsync("Whiff", 0.5f);
SoundByte.PlayOneShotGame("tossBoys/whiff"); SoundByte.PlayOneShotGame("tossBoys/whiff");
@ -40,7 +40,7 @@ namespace HeavenStudio.Games.Scripts_TossBoys
public void Bop() 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); DoAnimationScaledAsync("Bop", 0.5f);
} }

View file

@ -312,7 +312,7 @@ namespace HeavenStudio.Games
{ {
NPCBallTransporters.GetComponent<Animator>().Play("NPCGoBigMode", 0, 0); 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.ballTransporterLeftNPC.GetComponent<Animator>().Play("BallTransporterLeftOpen", 0, 0);
instance.ballTransporterRightNPC.GetComponent<Animator>().Play("BallTransporterRightOpen", 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 /// Returns true if animName is currently playing on animator
/// </summary> /// </summary>
/// <param name="anim">Animator to check</param> /// <param name="anim">Animator to check</param>
/// <param name="animName">name of animation to look out for</param> /// <param name="animNames">name(s) of animation to look out for</param>
public static bool IsPlayingAnimationName(this Animator anim, string animName) public static bool IsPlayingAnimationNames(this Animator anim, params string[] animNames)
{ {
var stateInfo = anim.GetCurrentAnimatorStateInfo(0); 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> /// <summary>