From cd00c13fa71d69e7bda299d9f78ed1f7c16e2435 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Thu, 17 Mar 2022 12:20:11 -0400 Subject: [PATCH 1/5] Fan Club: remove unused file --- Assets/Scripts/Games/FanClub/NtrIdolInput.cs | 86 ------------------- .../Games/FanClub/NtrIdolInput.cs.meta | 11 --- 2 files changed, 97 deletions(-) delete mode 100644 Assets/Scripts/Games/FanClub/NtrIdolInput.cs delete mode 100644 Assets/Scripts/Games/FanClub/NtrIdolInput.cs.meta diff --git a/Assets/Scripts/Games/FanClub/NtrIdolInput.cs b/Assets/Scripts/Games/FanClub/NtrIdolInput.cs deleted file mode 100644 index 243d0a25..00000000 --- a/Assets/Scripts/Games/FanClub/NtrIdolInput.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -using HeavenStudio.Util; - -namespace HeavenStudio.Games.Scripts_FanClub -{ - public class NtrIdolInput : PlayerActionObject - { - public float startBeat; - public int type; - public bool doCharge = false; - private bool hit = false; - private bool hasHit = false; - - void Start() - { - PlayerActionInit(gameObject, startBeat); - } - - public override void OnAce() - { - Hit(true, type, true); - } - - void Update() - { - if (Conductor.instance.GetPositionFromBeat(startBeat, 1.25f) >= 1) - { - FanClub.instance.AngerOnMiss(); - CleanUp(); - } - - if (!hit && Conductor.instance.GetPositionFromBeat(startBeat, 1) >= 1) - { - hit = true; - if (hasHit) CleanUp(); - } - - float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 1); - StateCheck(normalizedBeat); - - if (PlayerInput.Pressed() && type == 0) - { - if (state.perfect) - { - Hit(true); - } else if (state.notPerfect()) - { - Hit(false); - } - } - if (PlayerInput.PressedUp() && type == 1) - { - if (state.perfect) - { - Hit(true, type); - } else if (state.notPerfect()) - { - Hit(false, type); - } - } - } - - public void Hit(bool _hit, int type = 0, bool fromAutoplay = false) - { - if (!hasHit) - { - if (type == 0) - FanClub.instance.Player.ClapStart(_hit, true, doCharge, fromAutoplay); - else if (type == 1) - FanClub.instance.Player.JumpStart(_hit, true, fromAutoplay); - - hasHit = true; - - if (hit) CleanUp(); - } - } - - public void CleanUp() - { - Destroy(gameObject); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Games/FanClub/NtrIdolInput.cs.meta b/Assets/Scripts/Games/FanClub/NtrIdolInput.cs.meta deleted file mode 100644 index 9694eb63..00000000 --- a/Assets/Scripts/Games/FanClub/NtrIdolInput.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4d6294b6066d1254aa9d41878165a68e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: From 3e28dbcb0a915595277f38606010915270357062 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Thu, 17 Mar 2022 15:13:48 -0400 Subject: [PATCH 2/5] Fan Club: refactoring, fixes --- Assets/Scripts/Games/FanClub/FanClub.cs | 247 ++++++++++++--------- Assets/Scripts/Games/FanClub/NtrIdolFan.cs | 15 +- Assets/Scripts/Minigames.cs | 12 +- 3 files changed, 154 insertions(+), 120 deletions(-) diff --git a/Assets/Scripts/Games/FanClub/FanClub.cs b/Assets/Scripts/Games/FanClub/FanClub.cs index 0922a082..266932c6 100644 --- a/Assets/Scripts/Games/FanClub/FanClub.cs +++ b/Assets/Scripts/Games/FanClub/FanClub.cs @@ -11,6 +11,11 @@ namespace HeavenStudio.Games public class FanClub : Minigame { + public enum IdolBopType { + Both, + Idol, + Spectators + } public enum IdolAnimations { Bop, PeaceVocal, @@ -42,8 +47,11 @@ namespace HeavenStudio.Games //bop-type animations public GameEvent bop = new GameEvent(); public GameEvent specBop = new GameEvent(); - public GameEvent handCrap = new GameEvent(); - public GameEvent response = new GameEvent(); + public GameEvent noBop = new GameEvent(); + public GameEvent noSpecBop = new GameEvent(); + + private bool responseToggle = false; + //game scene public static FanClub instance; @@ -64,9 +72,9 @@ namespace HeavenStudio.Games // |========A========| // f==f==f==0==p==f==f - // =f==f==0==0==f==f== + // f==f==f==0==0==f==f==f - //spawn 10, the 4th is our player (idx 3) + //spawn 12, the 4th is our player (idx 3) Vector3 origin = spectatorAnchor.transform.localPosition; int sortOrigin = spectatorAnchor.GetComponent().sortingOrder; Vector3 spawnPos = new Vector3(origin.x, origin.y, origin.z); @@ -103,30 +111,34 @@ namespace HeavenStudio.Games { if (Conductor.instance.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) { - if (Conductor.instance.songPositionInBeats >= specBop.startBeat && Conductor.instance.songPositionInBeats < specBop.startBeat + specBop.length) - BopAll(); - - if (Conductor.instance.songPositionInBeats >= response.startBeat && Conductor.instance.songPositionInBeats < response.startBeat + response.length) + if (Conductor.instance.songPositionInBeats >= bop.startBeat && Conductor.instance.songPositionInBeats < bop.startBeat + bop.length) { - idolAnimator.Play("IdolResponse", 0, 0); - } - else if (Conductor.instance.songPositionInBeats >= handCrap.startBeat && Conductor.instance.songPositionInBeats < handCrap.startBeat + handCrap.length) - { - idolAnimator.Play("IdolCrap", 0, 0); - idolClapEffect.Play(); - } - else if (Conductor.instance.songPositionInBeats >= bop.startBeat && Conductor.instance.songPositionInBeats < bop.startBeat + bop.length) - { - idolAnimator.Play("IdolBeat", 0, 0); + if (!(Conductor.instance.songPositionInBeats >= noBop.startBeat && Conductor.instance.songPositionInBeats < noBop.startBeat + noBop.length)) + idolAnimator.Play("IdolBeat", 0, 0); } } + + if (Conductor.instance.ReportBeat(ref specBop.lastReportedBeat, specBop.startBeat % 1)) + { + if (Conductor.instance.songPositionInBeats >= specBop.startBeat && Conductor.instance.songPositionInBeats < specBop.startBeat + specBop.length) + { + if (!(Conductor.instance.songPositionInBeats >= noSpecBop.startBeat && Conductor.instance.songPositionInBeats < noSpecBop.startBeat + noSpecBop.length)) + BopAll(); + } + } + } - public void Bop(float beat, float length) + public void Bop(float beat, float length, int target = (int) IdolBopType.Both) { - bop.length = length; - bop.startBeat = beat; - SpecBop(beat, length); + if (target == (int) IdolBopType.Both || target == (int) IdolBopType.Idol) + { + bop.length = length; + bop.startBeat = beat; + } + + if (target == (int) IdolBopType.Both || target == (int) IdolBopType.Spectators) + SpecBop(beat, length); } public void SpecBop(float beat, float length) @@ -135,38 +147,53 @@ namespace HeavenStudio.Games specBop.startBeat = beat; } - public void PlayAnim(float beat, int type) + private void DisableBop(float beat, float length) { + noBop.length = length; + noBop.startBeat = beat; + } + + private void DisableSpecBop(float beat, float length) + { + noSpecBop.length = length; + noSpecBop.startBeat = beat; + } + + public void PlayAnim(float beat, float length, int type) + { + noBop.length = length; + noBop.startBeat = beat; + switch (type) { case (int) IdolAnimations.Bop: - idolAnimator.Play("IdolBeat", 0, 0); + idolAnimator.Play("IdolBeat"); break; case (int) IdolAnimations.PeaceVocal: - idolAnimator.Play("IdolPeace", 0, 0); + idolAnimator.Play("IdolPeace"); break; case (int) IdolAnimations.Peace: - idolAnimator.Play("IdolPeaceNoSync", 0, 0); + idolAnimator.Play("IdolPeaceNoSync"); break; case (int) IdolAnimations.Clap: - idolAnimator.Play("IdolCrap", 0, 0); + idolAnimator.Play("IdolCrap"); idolClapEffect.Play(); break; case (int) IdolAnimations.Call: BeatAction.New(Arisa, new List() { - new BeatAction.Action(beat, delegate { Arisa.GetComponent().Play("IdolCall0", 0, 0); }), - new BeatAction.Action(beat + 0.75f, delegate { Arisa.GetComponent().Play("IdolCall1", 0, 0); }), + new BeatAction.Action(beat, delegate { Arisa.GetComponent().Play("IdolCall0"); }), + new BeatAction.Action(beat + 0.75f, delegate { Arisa.GetComponent().Play("IdolCall1"); }), }); break; case (int) IdolAnimations.Response: - idolAnimator.Play("IdolResponse", 0, 0); + idolAnimator.Play("IdolResponse"); break; case (int) IdolAnimations.Jump: DoIdolJump(beat); break; case (int) IdolAnimations.Dab: - idolAnimator.Play("IdolDab", 0, 0); + idolAnimator.Play("IdolDab"); Jukebox.PlayOneShotGame("fanClub/arisa_dab"); break; } @@ -177,19 +204,29 @@ namespace HeavenStudio.Games } - const float HAIS_LENGTH = 4f; + private void DoIdolClaps() + { + if (!responseToggle) + { + idolAnimator.Play("IdolCrap", -1, 0); + idolClapEffect.Play(); + } + } + + private void DoIdolResponse() + { + if (responseToggle) + { + idolAnimator.Play("IdolResponse", -1, 0); + } + } + + const float HAIS_LENGTH = 4.5f; public void CallHai(float beat, int type = 0) { - bool shouldSpecBop = false; - // if spectators need to bop - if (specBop.startBeat + specBop.length > beat && specBop.startBeat < beat) - { - //let bopping continue *after* this cue - if (specBop.startBeat + specBop.length > beat + HAIS_LENGTH) - { - shouldSpecBop = true; - } - } + responseToggle = false; + DisableBop(beat, 8f); + DisableSpecBop(beat + 2.5f, 5f); MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("fanClub/arisa_hai_1_jp", beat), @@ -204,15 +241,15 @@ namespace HeavenStudio.Games BeatAction.New(Arisa, new List() { - new BeatAction.Action(beat, delegate { Arisa.GetComponent().Play("IdolPeace", 0, 0); if (shouldSpecBop) {BopAll();}}), - new BeatAction.Action(beat + 1f, delegate { Arisa.GetComponent().Play("IdolPeace", 0, 0); if (shouldSpecBop) {BopAll();}}), - new BeatAction.Action(beat + 2f, delegate { Arisa.GetComponent().Play("IdolPeace", 0, 0); if (shouldSpecBop) {BopAll();}}), - new BeatAction.Action(beat + 3f, delegate { Arisa.GetComponent().Play("IdolPeaceNoSync", 0, 0); PlayAnimationAll("FanPrepare"); }), + new BeatAction.Action(beat, delegate { Arisa.GetComponent().Play("IdolPeace", -1, 0);}), + new BeatAction.Action(beat + 1f, delegate { Arisa.GetComponent().Play("IdolPeace", -1, 0);}), + new BeatAction.Action(beat + 2f, delegate { Arisa.GetComponent().Play("IdolPeace", -1, 0);}), + new BeatAction.Action(beat + 3f, delegate { Arisa.GetComponent().Play("IdolPeaceNoSync"); PlayPrepare(); }), - new BeatAction.Action(beat + 4f, delegate { PlayOneClap(beat + 4f);}), - new BeatAction.Action(beat + 5f, delegate { PlayOneClap(beat + 5f);}), - new BeatAction.Action(beat + 6f, delegate { PlayOneClap(beat + 6f);}), - new BeatAction.Action(beat + 7f, delegate { PlayOneClap(beat + 7f);}), + new BeatAction.Action(beat + 4f, delegate { PlayOneClap(beat + 4f); DoIdolClaps();}), + new BeatAction.Action(beat + 5f, delegate { PlayOneClap(beat + 5f); DoIdolClaps();}), + new BeatAction.Action(beat + 6f, delegate { PlayOneClap(beat + 6f); DoIdolClaps();}), + new BeatAction.Action(beat + 7f, delegate { PlayOneClap(beat + 7f); DoIdolClaps();}), }); MultiSound.Play(new MultiSound.Sound[] { @@ -221,9 +258,6 @@ namespace HeavenStudio.Games new MultiSound.Sound("fanClub/crowd_hai_jp", beat + 6f), new MultiSound.Sound("fanClub/crowd_hai_jp", beat + 7f), }); - - handCrap.length = 4f; - handCrap.startBeat = beat + 4f; } public static void WarnHai(float beat, int type = 0) @@ -235,38 +269,17 @@ namespace HeavenStudio.Games }, forcePlay:true); } - const float CALL_LENGTH = 2f; + const float CALL_LENGTH = 2.5f; public void CallKamone(float beat, int type = 0, bool doJump = false) { - bool shouldSpecBop = false; - // clip certain events to the start of this cue if needed - if (bop.startBeat + bop.length > beat && bop.startBeat < beat) - { - //let bopping continue *after* this cue - if (bop.startBeat + bop.length > beat + CALL_LENGTH) - { - bop.length -= (beat + CALL_LENGTH - bop.startBeat); - bop.startBeat = beat + CALL_LENGTH; - } - else - bop.length = beat - bop.startBeat; - } - // interrupt clapping completely, no need to continue - if (handCrap.startBeat + handCrap.length > beat && handCrap.startBeat < beat) - handCrap.length = beat - handCrap.startBeat; - // same with responses - if (response.startBeat + response.length > beat && response.startBeat < beat) - response.length = beat - response.startBeat; - - // if spectators need to bop - if (specBop.startBeat + specBop.length > beat && specBop.startBeat < beat) - { - //let bopping continue *after* this cue - if (specBop.startBeat + specBop.length > beat + CALL_LENGTH) - { - shouldSpecBop = true; - } - } + responseToggle = true; + DisableBop(beat, doJump ? 6.25f : 5.25f); + DisableSpecBop(beat + 0.5f, 6f); + + Prepare(beat + 1f); + Prepare(beat + 2.5f); + Prepare(beat + 3f, 2); + Prepare(beat + 4f, 1); MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("fanClub/arisa_ka_jp", beat), @@ -276,18 +289,23 @@ namespace HeavenStudio.Games BeatAction.New(Arisa, new List() { - new BeatAction.Action(beat, delegate { Arisa.GetComponent().Play("IdolCall0", 0, 0); if (shouldSpecBop) {BopAll();}}), - new BeatAction.Action(beat + 0.75f, delegate { Arisa.GetComponent().Play("IdolCall1", 0, 0); }), - new BeatAction.Action(beat + 1f, delegate { PlayAnimationAll("FanPrepare"); Prepare(beat + 1f);}), + new BeatAction.Action(beat, delegate { Arisa.GetComponent().Play("IdolCall0", -1, 0); }), + new BeatAction.Action(beat + 0.75f, delegate { Arisa.GetComponent().Play("IdolCall1", -1, 0); }), + new BeatAction.Action(beat + 1f, delegate { PlayPrepare(); }), - new BeatAction.Action(beat + 2f, delegate { PlayLongClap(beat + 2f); Prepare(beat + 2.5f);}), - new BeatAction.Action(beat + 3.5f, delegate { PlayOneClap(beat + 3.5f); Prepare(beat + 3f, 2);}), - new BeatAction.Action(beat + 4f, delegate { PlayChargeClap(beat + 4f); Prepare(beat + 4f, 1);}), + new BeatAction.Action(beat + 2f, delegate { PlayLongClap(beat + 2f); DoIdolResponse(); }), + new BeatAction.Action(beat + 3f, delegate { DoIdolResponse(); }), + new BeatAction.Action(beat + 3.5f, delegate { PlayOneClap(beat + 3.5f); }), + new BeatAction.Action(beat + 4f, delegate { PlayChargeClap(beat + 4f); DoIdolResponse(); }), new BeatAction.Action(beat + 5f, delegate { PlayJump(beat + 5f); if (doJump) { DoIdolJump(beat + 5f); } + else + { + DoIdolResponse(); + } }), }); @@ -297,9 +315,6 @@ namespace HeavenStudio.Games new MultiSound.Sound("fanClub/crowd_ne_jp", beat + 4f), new MultiSound.Sound("fanClub/crowd_hey_jp", beat + 5f), }); - - response.length = doJump ? 3f : 4f; - response.startBeat = beat + CALL_LENGTH; } public static void WarnKamone(float beat, int type = 0) @@ -311,28 +326,21 @@ namespace HeavenStudio.Games }, forcePlay:true); } - const float BIGCALL_LENGTH = 2.5f; + const float BIGCALL_LENGTH = 2.75f; public void CallBigReady(float beat) { - // clip certain events to the start of this cue if needed - if (specBop.startBeat + specBop.length > beat && specBop.startBeat < beat) - { - //let bopping continue *after* this cue - if (specBop.startBeat + specBop.length > beat + BIGCALL_LENGTH) - { - specBop.length -= (beat + BIGCALL_LENGTH - specBop.startBeat); - specBop.startBeat = beat + BIGCALL_LENGTH; - } - else - specBop.length = beat - specBop.startBeat; - } + DisableSpecBop(beat, 3.75f); Jukebox.PlayOneShotGame("fanClub/crowd_big_ready"); + Prepare(beat + 1.5f); + Prepare(beat + 2f); + + PlayAnimationAll("FanBigReady", onlyOverrideBop: true); BeatAction.New(this.gameObject, new List() { - new BeatAction.Action(beat, delegate { PlayAnimationAll("FanBigReady"); Prepare(beat + 1.5f);}), - new BeatAction.Action(beat + 2f, delegate { PlayAnimationAll("FanBigReady"); Prepare(beat + 2f);}), + new BeatAction.Action(beat + 1.5f, delegate { PlayAnimationAll("FanBigReady", onlyOverrideBop: true); }), + new BeatAction.Action(beat + 2f, delegate { PlayAnimationAll("FanBigReady", onlyOverrideBop: true); }), new BeatAction.Action(beat + 2.5f, delegate { PlayOneClap(beat + 2.5f);}), new BeatAction.Action(beat + 3f, delegate { PlayOneClap(beat + 3f);}), }); @@ -348,7 +356,7 @@ namespace HeavenStudio.Games Player.AddHit(beat, type); } - private void PlayAnimationAll(string anim, bool noPlayer = false, bool doForced = false) + private void PlayAnimationAll(string anim, bool noPlayer = false, bool doForced = false, bool onlyOverrideBop = false) { for (int i = 0; i < Spectators.Count; i++) { @@ -356,7 +364,15 @@ namespace HeavenStudio.Games continue; if (!Spectators[i].GetComponent().IsAnimationNotPlaying() && !doForced) + { + if (onlyOverrideBop) + { + string clipName = Spectators[i].GetComponent().GetCurrentAnimatorClipInfo(0)[0].clip.name; + if (clipName == "FanBeat" || clipName == "NoPose") + Spectators[i].GetComponent().Play(anim); + } continue; + } Spectators[i].GetComponent().Play(anim); } } @@ -368,12 +384,27 @@ namespace HeavenStudio.Games if (i == 3 && noPlayer) continue; + string clipName = Spectators[i].GetComponent().GetCurrentAnimatorClipInfo(0)[0].clip.name; if (!Spectators[i].GetComponent().IsAnimationNotPlaying() && !doForced) + { + if (clipName == "FanBeat" || clipName == "NoPose") + Spectators[i].GetComponent().Bop(); continue; + } Spectators[i].GetComponent().Bop(); } } + private void PlayPrepare() + { + for (int i = 0; i < Spectators.Count; i++) + { + if (Spectators[i].GetComponent().IsJumping()) + continue; + Spectators[i].GetComponent().Play("FanPrepare"); + } + } + private void PlayOneClap(float beat) { BeatAction.New(this.gameObject, new List() diff --git a/Assets/Scripts/Games/FanClub/NtrIdolFan.cs b/Assets/Scripts/Games/FanClub/NtrIdolFan.cs index 910ce147..64e3106c 100644 --- a/Assets/Scripts/Games/FanClub/NtrIdolFan.cs +++ b/Assets/Scripts/Games/FanClub/NtrIdolFan.cs @@ -205,7 +205,6 @@ namespace HeavenStudio.Games.Scripts_FanClub var cond = Conductor.instance; if (hit) { - print("HIT"); if (doCharge) BeatAction.New(this.gameObject, new List() { @@ -220,7 +219,6 @@ namespace HeavenStudio.Games.Scripts_FanClub } else { - print("missed"); FanClub.instance.AngerOnMiss(); } if (fromAutoplay || !force) @@ -249,12 +247,9 @@ namespace HeavenStudio.Games.Scripts_FanClub { var cond = Conductor.instance; if (hit) - { - print("HIT"); - } + {} else { - print("missed"); FanClub.instance.AngerOnMiss(); } if (fromAutoplay || !force) @@ -266,10 +261,16 @@ namespace HeavenStudio.Games.Scripts_FanClub } } + public bool IsJumping() + { + var cond = Conductor.instance; + return (cond.songPositionInBeats >= jumpStartTime && cond.songPositionInBeats < jumpStartTime + 1f); + } + public void Bop() { if (!stopBeat) - animator.Play("FanBeat", 0, 0); + animator.Play("FanBeat"); } public void ClapParticle() diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 2dc7427b..0029b391 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -426,19 +426,21 @@ namespace HeavenStudio new Minigame("fanClub", "Fan Club \n[WIP]", "FDFD00", false, false, new List() { // TODO: proper names - new GameAction("bop", delegate { FanClub.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 0.5f, true), - // new GameAction("bop (spectators)", delegate { FanClub.instance.SpecBop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 0.5f, true), - new GameAction("yeah, yeah, yeah", delegate { FanClub.instance.CallHai(eventCaller.currentEntity.beat); }, 8, false, + new GameAction("bop", delegate { var e = eventCaller.currentEntity; FanClub.instance.Bop(e.beat, e.length, e.type); }, 0.5f, true, parameters: new List() + { + new Param("type", FanClub.IdolBopType.Both, "Bop target", "Who to make bop"), + }), + new GameAction("yeah, yeah, yeah", delegate { var e = eventCaller.currentEntity; FanClub.instance.CallHai(e.beat); }, 8, false, // TODO: pre-switch cues inactiveFunction: delegate { FanClub.WarnHai(eventCaller.currentEntity.beat); }), - new GameAction("I suppose", delegate { FanClub.instance.CallKamone(eventCaller.currentEntity.beat); }, 6, false, + new GameAction("I suppose", delegate { var e = eventCaller.currentEntity; FanClub.instance.CallKamone(e.beat); }, 6, false, // TODO: pre-switch cues inactiveFunction: delegate { FanClub.WarnKamone(eventCaller.currentEntity.beat); }), new GameAction("double clap", delegate { FanClub.instance.CallBigReady(eventCaller.currentEntity.beat); }, 4, false, // TODO: pre-switch cues inactiveFunction: delegate { FanClub.WarnBigReady(eventCaller.currentEntity.beat); }), - new GameAction("play idol animation", delegate { var e = eventCaller.currentEntity; FanClub.instance.PlayAnim(e.beat, e.type); }, 0.5f, parameters: new List() + new GameAction("play idol animation", delegate { var e = eventCaller.currentEntity; FanClub.instance.PlayAnim(e.beat, e.length, e.type); }, 1f, parameters: new List() { new Param("type", FanClub.IdolAnimations.Bop, "Animation", "Animation to play") }), From bce671dc857446df102d069c2f2268c5646573cb Mon Sep 17 00:00:00 2001 From: minenice55 Date: Thu, 17 Mar 2022 15:18:40 -0400 Subject: [PATCH 3/5] Fan Club: make forced animations properly restart --- Assets/Scripts/Games/FanClub/FanClub.cs | 16 ++++++++-------- Assets/Scripts/Minigames.cs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Assets/Scripts/Games/FanClub/FanClub.cs b/Assets/Scripts/Games/FanClub/FanClub.cs index 266932c6..67d0a933 100644 --- a/Assets/Scripts/Games/FanClub/FanClub.cs +++ b/Assets/Scripts/Games/FanClub/FanClub.cs @@ -167,33 +167,33 @@ namespace HeavenStudio.Games switch (type) { case (int) IdolAnimations.Bop: - idolAnimator.Play("IdolBeat"); + idolAnimator.Play("IdolBeat", -1, 0); break; case (int) IdolAnimations.PeaceVocal: - idolAnimator.Play("IdolPeace"); + idolAnimator.Play("IdolPeace", -1, 0); break; case (int) IdolAnimations.Peace: - idolAnimator.Play("IdolPeaceNoSync"); + idolAnimator.Play("IdolPeaceNoSync", -1, 0); break; case (int) IdolAnimations.Clap: - idolAnimator.Play("IdolCrap"); + idolAnimator.Play("IdolCrap", -1, 0); idolClapEffect.Play(); break; case (int) IdolAnimations.Call: BeatAction.New(Arisa, new List() { - new BeatAction.Action(beat, delegate { Arisa.GetComponent().Play("IdolCall0"); }), - new BeatAction.Action(beat + 0.75f, delegate { Arisa.GetComponent().Play("IdolCall1"); }), + new BeatAction.Action(beat, delegate { Arisa.GetComponent().Play("IdolCall0", -1, 0); }), + new BeatAction.Action(beat + 0.75f, delegate { Arisa.GetComponent().Play("IdolCall1", -1, 0); }), }); break; case (int) IdolAnimations.Response: - idolAnimator.Play("IdolResponse"); + idolAnimator.Play("IdolResponse", -1, 0); break; case (int) IdolAnimations.Jump: DoIdolJump(beat); break; case (int) IdolAnimations.Dab: - idolAnimator.Play("IdolDab"); + idolAnimator.Play("IdolDab", -1, 0); Jukebox.PlayOneShotGame("fanClub/arisa_dab"); break; } diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 0029b391..37d880e7 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -440,7 +440,7 @@ namespace HeavenStudio new GameAction("double clap", delegate { FanClub.instance.CallBigReady(eventCaller.currentEntity.beat); }, 4, false, // TODO: pre-switch cues inactiveFunction: delegate { FanClub.WarnBigReady(eventCaller.currentEntity.beat); }), - new GameAction("play idol animation", delegate { var e = eventCaller.currentEntity; FanClub.instance.PlayAnim(e.beat, e.length, e.type); }, 1f, parameters: new List() + new GameAction("play idol animation", delegate { var e = eventCaller.currentEntity; FanClub.instance.PlayAnim(e.beat, e.length, e.type); }, 1f, true, parameters: new List() { new Param("type", FanClub.IdolAnimations.Bop, "Animation", "Animation to play") }), From 65918bd950af971e1b8db75bd7f44aad9caebf5d Mon Sep 17 00:00:00 2001 From: minenice55 Date: Thu, 17 Mar 2022 16:43:35 -0400 Subject: [PATCH 4/5] Fan Club: add cues continuing from transition, muted cues --- Assets/Scripts/Games/FanClub/FanClub.cs | 94 ++++++++++++++++------ Assets/Scripts/Games/FanClub/NtrIdolFan.cs | 2 +- Assets/Scripts/Minigames.cs | 33 +++++--- 3 files changed, 93 insertions(+), 36 deletions(-) diff --git a/Assets/Scripts/Games/FanClub/FanClub.cs b/Assets/Scripts/Games/FanClub/FanClub.cs index 67d0a933..39b93986 100644 --- a/Assets/Scripts/Games/FanClub/FanClub.cs +++ b/Assets/Scripts/Games/FanClub/FanClub.cs @@ -1,6 +1,7 @@ using HeavenStudio.Util; using System.Collections; using System.Collections.Generic; +using System; using UnityEngine; using UnityEngine.Rendering; //don't ask @@ -51,6 +52,9 @@ namespace HeavenStudio.Games public GameEvent noSpecBop = new GameEvent(); private bool responseToggle = false; + private static float wantHais = Single.MinValue; + private static float wantKamone = Single.MinValue; + private static float wantBigReady = Single.MinValue; //game scene public static FanClub instance; @@ -107,6 +111,25 @@ namespace HeavenStudio.Games } } + public override void OnGameSwitch(float beat) + { + if (wantHais != Single.MinValue) + { + ContinueHais(wantHais); + wantHais = Single.MinValue; + } + if (wantKamone != Single.MinValue) + { + ContinueKamone(wantKamone); + wantKamone = Single.MinValue; + } + if (wantBigReady != Single.MinValue) + { + ContinueBigReady(wantBigReady); + wantBigReady = Single.MinValue; + } + } + private void Update() { if (Conductor.instance.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1)) @@ -222,19 +245,20 @@ namespace HeavenStudio.Games } const float HAIS_LENGTH = 4.5f; - public void CallHai(float beat, int type = 0) + public void CallHai(float beat, bool noSound = false, int type = 0) { + if (!noSound) + MultiSound.Play(new MultiSound.Sound[] { + new MultiSound.Sound("fanClub/arisa_hai_1_jp", beat), + new MultiSound.Sound("fanClub/arisa_hai_2_jp", beat + 1f), + new MultiSound.Sound("fanClub/arisa_hai_3_jp", beat + 2f), + }); + + Prepare(beat + 3f); responseToggle = false; DisableBop(beat, 8f); DisableSpecBop(beat + 2.5f, 5f); - MultiSound.Play(new MultiSound.Sound[] { - new MultiSound.Sound("fanClub/arisa_hai_1_jp", beat), - new MultiSound.Sound("fanClub/arisa_hai_2_jp", beat + 1f), - new MultiSound.Sound("fanClub/arisa_hai_3_jp", beat + 2f), - }); - - Prepare(beat + 3f); Prepare(beat + 4f); Prepare(beat + 5f); Prepare(beat + 6f); @@ -260,8 +284,10 @@ namespace HeavenStudio.Games }); } - public static void WarnHai(float beat, int type = 0) + public static void WarnHai(float beat, bool noSound = false, int type = 0) { + wantHais = beat; + if (noSound) return; MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("fanClub/arisa_hai_1_jp", beat), new MultiSound.Sound("fanClub/arisa_hai_2_jp", beat + 1f), @@ -269,9 +295,21 @@ namespace HeavenStudio.Games }, forcePlay:true); } - const float CALL_LENGTH = 2.5f; - public void CallKamone(float beat, int type = 0, bool doJump = false) + public void ContinueHais(float beat, int type = 0) { + CallHai(beat, true, type); + } + + const float CALL_LENGTH = 2.5f; + public void CallKamone(float beat, bool noSound = false, int type = 0, bool doJump = false) + { + if (!noSound) + MultiSound.Play(new MultiSound.Sound[] { + new MultiSound.Sound("fanClub/arisa_ka_jp", beat), + new MultiSound.Sound("fanClub/arisa_mo_jp", beat + 0.5f), + new MultiSound.Sound("fanClub/arisa_ne_jp", beat + 1f), + }); + responseToggle = true; DisableBop(beat, doJump ? 6.25f : 5.25f); DisableSpecBop(beat + 0.5f, 6f); @@ -281,12 +319,6 @@ namespace HeavenStudio.Games Prepare(beat + 3f, 2); Prepare(beat + 4f, 1); - MultiSound.Play(new MultiSound.Sound[] { - new MultiSound.Sound("fanClub/arisa_ka_jp", beat), - new MultiSound.Sound("fanClub/arisa_mo_jp", beat + 0.5f), - new MultiSound.Sound("fanClub/arisa_ne_jp", beat + 1f), - }); - BeatAction.New(Arisa, new List() { new BeatAction.Action(beat, delegate { Arisa.GetComponent().Play("IdolCall0", -1, 0); }), @@ -317,8 +349,10 @@ namespace HeavenStudio.Games }); } - public static void WarnKamone(float beat, int type = 0) + public static void WarnKamone(float beat, bool noSound = false, int type = 0) { + wantKamone = beat; + if (noSound) return; MultiSound.Play(new MultiSound.Sound[] { new MultiSound.Sound("fanClub/arisa_ka_jp", beat), new MultiSound.Sound("fanClub/arisa_mo_jp", beat + 0.5f), @@ -326,13 +360,18 @@ namespace HeavenStudio.Games }, forcePlay:true); } - const float BIGCALL_LENGTH = 2.75f; - public void CallBigReady(float beat) + public void ContinueKamone(float beat, int type = 0, bool doJump = false) { + CallKamone(beat, true, type, doJump); + } + + const float BIGCALL_LENGTH = 2.75f; + public void CallBigReady(float beat, bool noSound = false) + { + if (!noSound) + Jukebox.PlayOneShotGame("fanClub/crowd_big_ready"); + DisableSpecBop(beat, 3.75f); - - Jukebox.PlayOneShotGame("fanClub/crowd_big_ready"); - Prepare(beat + 1.5f); Prepare(beat + 2f); @@ -346,11 +385,18 @@ namespace HeavenStudio.Games }); } - public static void WarnBigReady(float beat) + public static void WarnBigReady(float beat, bool noSound = false) { + wantBigReady = beat; + if (noSound) return; Jukebox.PlayOneShotGame("fanClub/crowd_big_ready"); } + public void ContinueBigReady(float beat) + { + CallBigReady(beat, true); + } + public void Prepare(float beat, int type = 0) { Player.AddHit(beat, type); diff --git a/Assets/Scripts/Games/FanClub/NtrIdolFan.cs b/Assets/Scripts/Games/FanClub/NtrIdolFan.cs index 64e3106c..a06e526b 100644 --- a/Assets/Scripts/Games/FanClub/NtrIdolFan.cs +++ b/Assets/Scripts/Games/FanClub/NtrIdolFan.cs @@ -22,7 +22,7 @@ namespace HeavenStudio.Games.Scripts_FanClub [Header("Properties")] [NonSerialized] public bool player = false; [NonSerialized] public bool hitValid = false; - public float jumpStartTime = -99f; + public float jumpStartTime = Single.MinValue; bool stopBeat = false; bool stopCharge = false; bool hasJumped = false; diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 37d880e7..28702676 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -425,22 +425,33 @@ namespace HeavenStudio }), new Minigame("fanClub", "Fan Club \n[WIP]", "FDFD00", false, false, new List() { - // TODO: proper names new GameAction("bop", delegate { var e = eventCaller.currentEntity; FanClub.instance.Bop(e.beat, e.length, e.type); }, 0.5f, true, parameters: new List() { new Param("type", FanClub.IdolBopType.Both, "Bop target", "Who to make bop"), }), - new GameAction("yeah, yeah, yeah", delegate { var e = eventCaller.currentEntity; FanClub.instance.CallHai(e.beat); }, 8, false, - // TODO: pre-switch cues - inactiveFunction: delegate { FanClub.WarnHai(eventCaller.currentEntity.beat); }), - new GameAction("I suppose", delegate { var e = eventCaller.currentEntity; FanClub.instance.CallKamone(e.beat); }, 6, false, - // TODO: pre-switch cues - inactiveFunction: delegate { FanClub.WarnKamone(eventCaller.currentEntity.beat); }), - new GameAction("double clap", delegate { FanClub.instance.CallBigReady(eventCaller.currentEntity.beat); }, 4, false, - // TODO: pre-switch cues - inactiveFunction: delegate { FanClub.WarnBigReady(eventCaller.currentEntity.beat); }), - new GameAction("play idol animation", delegate { var e = eventCaller.currentEntity; FanClub.instance.PlayAnim(e.beat, e.length, e.type); }, 1f, true, parameters: new List() + new GameAction("yeah, yeah, yeah", delegate { var e = eventCaller.currentEntity; FanClub.instance.CallHai(e.beat, e.toggle); }, 8, false, parameters: new List() + { + new Param("toggle", false, "Disable call", "Disable the idol's call") + }, + inactiveFunction: delegate { var e = eventCaller.currentEntity; FanClub.WarnHai(e.beat, e.toggle);} + ), + + new GameAction("I suppose", delegate { var e = eventCaller.currentEntity; FanClub.instance.CallKamone(e.beat, e.toggle); }, 6, false, parameters: new List() + { + new Param("toggle", false, "Disable call", "Disable the idol's call") + }, + inactiveFunction: delegate { var e = eventCaller.currentEntity; FanClub.WarnKamone(e.beat, e.toggle);} + ), + + new GameAction("double clap", delegate { var e = eventCaller.currentEntity; FanClub.instance.CallBigReady(e.beat, e.toggle); }, 4, false, parameters: new List() + { + new Param("toggle", false, "Disable call", "Disable the call") + }, + inactiveFunction: delegate { var e = eventCaller.currentEntity; FanClub.WarnBigReady(e.beat, e.toggle); } + ), + + new GameAction("play idol animation", delegate { var e = eventCaller.currentEntity; FanClub.instance.PlayAnim(e.beat, e.length, e.type); }, 1, true, parameters: new List() { new Param("type", FanClub.IdolAnimations.Bop, "Animation", "Animation to play") }), From dc46781d4088ac20a59be682c344d9780c6ee867 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Thu, 17 Mar 2022 17:01:26 -0400 Subject: [PATCH 5/5] Fan Club: landing sound --- Assets/Scripts/Games/FanClub/NtrIdolFan.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Games/FanClub/NtrIdolFan.cs b/Assets/Scripts/Games/FanClub/NtrIdolFan.cs index a06e526b..d3b24145 100644 --- a/Assets/Scripts/Games/FanClub/NtrIdolFan.cs +++ b/Assets/Scripts/Games/FanClub/NtrIdolFan.cs @@ -191,10 +191,14 @@ namespace HeavenStudio.Games.Scripts_FanClub { motionRoot.transform.localPosition = new Vector3(0, 0); shadow.transform.localScale = new Vector3(1.4f, 1.4f, 1f); - if (hasJumped && player) + if (hasJumped) { - animator.Play("FanPrepare", 0, 0); - stopBeat = false; + Jukebox.PlayOneShotGame("fanClub/landing_impact", pitch: UnityEngine.Random.Range(0.95f, 1f), volume: 1f/4); + if (player) + { + animator.Play("FanPrepare", 0, 0); + stopBeat = false; + } } hasJumped = false; }