From a526580cf9aa3bd3a49ae1710792c982cd310741 Mon Sep 17 00:00:00 2001 From: RaffyTaffy14 Date: Sat, 4 Feb 2023 00:16:52 -0500 Subject: [PATCH] Bop Block Rework Bop block reworked to be a toggle. Also made a few minor tweaks to random things. --- .../SumoBrothers/Animations/InuCrouch.anim | 10 ++-- .../Games/SumoBrothers/SumoBrothers.cs | 56 +++++++++++++------ 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/Assets/Resources/Sprites/Games/SumoBrothers/Animations/InuCrouch.anim b/Assets/Resources/Sprites/Games/SumoBrothers/Animations/InuCrouch.anim index 43f1a1f40..06cfb747d 100644 --- a/Assets/Resources/Sprites/Games/SumoBrothers/Animations/InuCrouch.anim +++ b/Assets/Resources/Sprites/Games/SumoBrothers/Animations/InuCrouch.anim @@ -19,7 +19,7 @@ AnimationClip: m_Curve: - serializedVersion: 3 time: 0 - value: {x: 0, y: 0, z: -80} + value: {x: 0, y: 0, z: -70} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} tangentMode: 0 @@ -68,7 +68,7 @@ AnimationClip: m_Curve: - serializedVersion: 3 time: 0 - value: {x: 0.7, y: -0.4, z: 0} + value: {x: 0.8, y: -0.3, z: 0} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} tangentMode: 0 @@ -513,7 +513,7 @@ AnimationClip: m_Curve: - serializedVersion: 3 time: 0 - value: 0.7 + value: 0.8 inSlope: 0 outSlope: 0 tangentMode: 136 @@ -532,7 +532,7 @@ AnimationClip: m_Curve: - serializedVersion: 3 time: 0 - value: -0.4 + value: -0.3 inSlope: 0 outSlope: 0 tangentMode: 136 @@ -608,7 +608,7 @@ AnimationClip: m_Curve: - serializedVersion: 3 time: 0 - value: -80 + value: -70 inSlope: 0 outSlope: 0 tangentMode: 136 diff --git a/Assets/Scripts/Games/SumoBrothers/SumoBrothers.cs b/Assets/Scripts/Games/SumoBrothers/SumoBrothers.cs index 0464860b8..7a6fc0293 100644 --- a/Assets/Scripts/Games/SumoBrothers/SumoBrothers.cs +++ b/Assets/Scripts/Games/SumoBrothers/SumoBrothers.cs @@ -17,10 +17,10 @@ namespace HeavenStudio.Games.Loaders function = delegate { var e = eventCaller.currentEntity; SumoBrothers.instance.Bop(e["toggle"], e["toggle1"]); }, parameters = new List() { - new Param("toggle", true, "Inu Bop", "Inu Sensei bops or not."), - new Param("toggle1", true, "Brothers Bop", "Sumo Brothers bop or not."), + new Param("toggle", true, "Inu Bop", "Whether Inu Sensei bops or not."), + new Param("toggle1", true, "Brothers Bop", "Whether the Sumo Brothers bop or not."), }, - defaultLength = 1f + defaultLength = 0.5f }, new GameAction("crouch", "Crouch") @@ -28,8 +28,8 @@ namespace HeavenStudio.Games.Loaders function = delegate { var e = eventCaller.currentEntity; SumoBrothers.instance.Crouch(e.beat, e.length, e["toggle"], e["toggle1"]); }, parameters = new List() { - new Param("toggle", true, "Inu Crouch", "Inu Sensei crouches or not."), - new Param("toggle1", true, "Brothers Crouch", "Sumo Brothers crouche or not.") + new Param("toggle", true, "Inu Crouch", "Whether Inu Sensei crouches or not."), + new Param("toggle1", true, "Brothers Crouch", "Whether the Sumo Brothers crouch or not.") }, defaultLength = 1f, resizable = true @@ -54,11 +54,22 @@ namespace HeavenStudio.Games [Header("Components")] [SerializeField] Animator inuSensei; + [Header("Properties")] + public bool goBopSumo; + public bool goBopInu; + public bool allowBopSumo; + public bool allowBopInu; + private float lastReportedBeat = 0f; + public static SumoBrothers instance; // Start is called before the first frame update void Awake() { + goBopInu = true; + goBopSumo = true; + allowBopInu = true; + allowBopSumo = true; instance = this; } @@ -66,27 +77,33 @@ namespace HeavenStudio.Games // Update is called once per frame void Update() { + var cond = Conductor.instance; + if (cond.ReportBeat(ref lastReportedBeat)) + { + if (goBopInu && allowBopInu) + { + inuSensei.DoScaledAnimationAsync("InuBop", 0.5f); + + } + + } } public void Bop(bool inu, bool sumo) { - if (inu) - { - inuSensei.DoScaledAnimationAsync("InuBop", 0.5f); - - } - if (sumo) - { - - } + goBopInu = inu; + goBopSumo = sumo; } public void Crouch(float beat, float length, bool inu, bool sumo) { + allowBopInu = false; BeatAction.New(instance.gameObject, new List() { - new BeatAction.Action(beat, delegate { if (inu) inuSensei.DoScaledAnimationAsync("InuCrouch", 0.5f); }), - new BeatAction.Action(beat + length, delegate { if (inu) inuSensei.DoScaledAnimationAsync("InuIdle", 0.5f); }) + new BeatAction.Action(beat, delegate { if (inu == true) inuSensei.DoScaledAnimationAsync("InuCrouch", 0.5f); }), + new BeatAction.Action(beat + length, delegate { allowBopInu = true; }), + new BeatAction.Action(beat + length, delegate { if (goBopInu == false) inuSensei.DoScaledAnimationAsync("InuIdle", 0.5f); }), + new BeatAction.Action(beat + length, delegate { if (goBopInu == true) inuSensei.DoScaledAnimationAsync("InuBop", 0.5f); }) }); } @@ -111,11 +128,14 @@ namespace HeavenStudio.Games MultiSound.Play(sound.ToArray()); + allowBopInu = false; + inuSensei.DoScaledAnimationAsync("InuTweet", 0.5f); var tweetLength = (float)loopAmount * (float)soundBeatLength - (float)soundBeatLength + ((float)beatsPerSecond * 0.208f); print(tweetLength); BeatAction.New(instance.gameObject, new List() { - new BeatAction.Action(beat, delegate { if (GameManager.instance.currentGame == "sumoBrothers") inuSensei.DoScaledAnimationAsync("InuTweet", 0.5f); }), - new BeatAction.Action(beat + tweetLength + 1, delegate { if (GameManager.instance.currentGame == "sumoBrothers") inuSensei.DoScaledAnimationAsync("InuIdle", 0.5f); }) + new BeatAction.Action(beat + tweetLength + 1, delegate { allowBopInu = true; }), + new BeatAction.Action(beat + tweetLength + 1, delegate { if (goBopInu == false) inuSensei.DoScaledAnimationAsync("InuIdle", 0.5f); }), + new BeatAction.Action(beat + tweetLength + 1, delegate { if (goBopInu == true) inuSensei.DoScaledAnimationAsync("InuBop", 0.5f); }) });