diff --git a/Assets/Scripts/CircleCursor.cs b/Assets/Scripts/CircleCursor.cs index 1f9af599c..4c7ccf680 100644 --- a/Assets/Scripts/CircleCursor.cs +++ b/Assets/Scripts/CircleCursor.cs @@ -24,6 +24,29 @@ namespace HeavenStudio // Cursor.visible = false; } + private void Open() + { + Circle.transform.DOScale(0, 0.5f).SetEase(Ease.OutExpo); + InnerCircle.SetActive(true); + outerCircleTween.Kill(); + outerCircleTween = OuterCircle.transform.DOScale(1, 0.15f).SetEase(Ease.OutExpo); + + Eyes.SetActive(true); + eyesTween.Kill(); + eyesTween = Eyes.transform.DOLocalMoveY(0.15f, 0.15f).SetEase(Ease.OutExpo); + } + + private void Close() + { + Circle.transform.DOScale(0.2f, 0.5f).SetEase(Ease.OutExpo); + InnerCircle.SetActive(false); + outerCircleTween.Kill(); + outerCircleTween = OuterCircle.transform.DOScale(0, 0.15f); + + eyesTween.Kill(); + eyesTween = Eyes.transform.DOLocalMoveY(-0.66f, 0.15f).OnComplete(delegate { Eyes.SetActive(false); }); + } + private void Update() { Vector3 pos = PlayerInput.GetInputController(1).GetPointer(); @@ -39,24 +62,21 @@ namespace HeavenStudio if (PlayerInput.GetIsAction(Minigame.InputAction_BasicPress)) { - Circle.transform.DOScale(0, 0.5f).SetEase(Ease.OutExpo); - InnerCircle.SetActive(true); - outerCircleTween.Kill(); - outerCircleTween = OuterCircle.transform.DOScale(1, 0.15f).SetEase(Ease.OutExpo); - - Eyes.SetActive(true); - eyesTween.Kill(); - eyesTween = Eyes.transform.DOLocalMoveY(0.15f, 0.15f).SetEase(Ease.OutExpo); + Open(); } else if (PlayerInput.GetIsAction(Minigame.InputAction_BasicRelease)) { - Circle.transform.DOScale(0.2f, 0.5f).SetEase(Ease.OutExpo); - InnerCircle.SetActive(false); - outerCircleTween.Kill(); - outerCircleTween = OuterCircle.transform.DOScale(0, 0.15f); + Close(); + } + else if (PlayerInput.GetIsAction(Minigame.InputAction_FlickRelease)) + { + // TODO: flick animation + Close(); + } - eyesTween.Kill(); - eyesTween = Eyes.transform.DOLocalMoveY(-0.66f, 0.15f).OnComplete(delegate { Eyes.SetActive(false); }); + if ((!PlayerInput.PlayerHasControl()) && InnerCircle.activeSelf) + { + Close(); } } } diff --git a/Assets/Scripts/Games/CatchyTune/Fruit.cs b/Assets/Scripts/Games/CatchyTune/Fruit.cs index d6954051f..ee525f3df 100644 --- a/Assets/Scripts/Games/CatchyTune/Fruit.cs +++ b/Assets/Scripts/Games/CatchyTune/Fruit.cs @@ -78,11 +78,11 @@ namespace HeavenStudio.Games.Scripts_CatchyTune { if (barelyStart > 0f) { - anim.DoScaledAnimation("barely", barelyStart, isPineapple ? 2f : 1f); + anim.DoScaledAnimation("barely", barelyStart, isPineapple ? 2f : 1f, clamp: true); } else { - anim.DoScaledAnimation("fruit bounce", startBeat, beatLength + (isPineapple ? 4f : 2f)); + anim.DoScaledAnimation("fruit bounce", startBeat, beatLength + (isPineapple ? 4f : 2f), clamp: true); } } diff --git a/Assets/Scripts/Games/DJSchool/DJSchool.cs b/Assets/Scripts/Games/DJSchool/DJSchool.cs index 3003684f6..fdc3dcb6e 100644 --- a/Assets/Scripts/Games/DJSchool/DJSchool.cs +++ b/Assets/Scripts/Games/DJSchool/DJSchool.cs @@ -128,6 +128,10 @@ namespace HeavenStudio.Games public static DJSchool instance { get; private set; } + public static PlayerInput.InputAction InputAction_TouchRelease = + new("NtrDjTouchRelease", new int[] { IAEmptyCat, IAReleaseCat, IAEmptyCat }, + IA_Empty, IA_TouchBasicRelease, IA_Empty); + private void Awake() { instance = this; @@ -250,34 +254,31 @@ namespace HeavenStudio.Games lastReportedBeat = Math.Round(Conductor.instance.songPositionInBeatsAsDouble); } - if(PlayerInput.Pressed() && !IsExpectingInputNow() && !student.isHolding) //Start hold miss + if(PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress) && !student.isHolding) //Start hold miss { student.OnMissHoldForPlayerInput(); student.isHolding = true; ScoreMiss(); } - else if(PlayerInput.PressedUp() && !IsExpectingInputNow() && student.isHolding) //Let go during hold + else if(((PlayerInput.GetIsAction(InputAction_BasicRelease) && !IsExpectingInputNow(InputAction_FlickRelease)) + || PlayerInput.GetIsAction(InputAction_TouchRelease)) + && student.isHolding) //Let go during hold { student.UnHold(); shouldBeHolding = false; } - else if (!GameManager.instance.autoplay && shouldBeHolding && !PlayerInput.Pressing() && !IsExpectingInputNow(InputType.STANDARD_UP)) + else if(PlayerInput.GetIsAction(InputAction_FlickRelease) && !IsExpectingInputNow(InputAction_FlickRelease) && student.isHolding) //Flick during hold + { + student.OnFlickSwipe(); + shouldBeHolding = false; + } + else if (!GameManager.instance.autoplay && shouldBeHolding && !PlayerInput.GetIsAction(InputAction_BasicPressing) && !IsExpectingInputNow(InputAction_FlickRelease)) { student.UnHold(); shouldBeHolding = false; } - //else if(PlayerInput.PressedUp() && !IsExpectingInputNow() && !student.isHolding) - //{ - // student.OnMissSwipeForPlayerInput(); - //} } - //public void Bop(float beat, float length) - //{ - // bop.startBeat = beat; - // bop.length = length; - //} - public void ForceHold() { student.ForceHold(); @@ -401,7 +402,7 @@ namespace HeavenStudio.Games }), }); andStop = true; - ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, student.OnHitHold, student.OnMissHold, student.OnEmpty); + ScheduleInput(beat, 2f, InputAction_BasicPress, student.OnHitHold, student.OnMissHold, student.OnEmpty); } public void AndStop(double beat, bool ooh, bool doSound = true) @@ -447,7 +448,7 @@ namespace HeavenStudio.Games }); andStop = true; - ScheduleInput(beat, 1.5f, InputType.STANDARD_DOWN, student.OnHitHold, student.OnMissHold, student.OnEmpty); + ScheduleInput(beat, 1.5f, InputAction_BasicPress, student.OnHitHold, student.OnMissHold, student.OnEmpty); } public void ScratchoHey(double beat, int type, bool remix4, bool cheer) @@ -511,11 +512,11 @@ namespace HeavenStudio.Games if (cheer) { - ScheduleInput(beat, timing, InputType.STANDARD_UP, student.OnHitSwipeCheer, student.OnMissSwipe, student.OnEmpty); + ScheduleInput(beat, timing, InputAction_FlickRelease, student.OnHitSwipeCheer, student.OnMissSwipe, student.OnEmpty); } else { - ScheduleInput(beat, timing, InputType.STANDARD_UP, student.OnHitSwipe, student.OnMissSwipe, student.OnEmpty); + ScheduleInput(beat, timing, InputAction_FlickRelease, student.OnHitSwipe, student.OnMissSwipe, student.OnEmpty); } andStop = false; diff --git a/Assets/Scripts/Games/DJSchool/Student.cs b/Assets/Scripts/Games/DJSchool/Student.cs index 2b8287341..f85881ab3 100644 --- a/Assets/Scripts/Games/DJSchool/Student.cs +++ b/Assets/Scripts/Games/DJSchool/Student.cs @@ -45,7 +45,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool private void Update() { - + } #region old hold @@ -127,7 +127,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool Sound booSound = SoundByte.PlayOneShotGame("djSchool/boo", -1, 1, 0.8f); CancelInvoke(); canBoo = false; - Invoke("EnableBoo", booSound.clip.length); + Invoke("EnableBoo", 1f); } if (!game.djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.UpFirst) && !game.djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.UpSecond)) @@ -146,7 +146,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool missed = true; SoundByte.PlayOneShotGame("djSchool/recordStop"); - + anim.DoScaledAnimationAsync("Hold", 0.5f); tableAnim.DoScaledAnimationAsync("Student_Turntable_StartHold", 0.5f); if (!game.djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.UpFirst) && !game.djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.UpSecond)) @@ -173,7 +173,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool Sound booSound = SoundByte.PlayOneShotGame("djSchool/boo", -1, 1, 0.8f); CancelInvoke(); canBoo = false; - Invoke("EnableBoo", booSound.clip.length); + Invoke("EnableBoo", 1f); } missed = true; mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f); @@ -224,7 +224,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool } else { - OnMissSwipeForPlayerInput(caller.timer + caller.startBeat + 1f); + OnMissSwipeForPlayerInput(caller.timer + caller.startBeat + 1); SoundByte.PlayOneShotGame("djSchool/recordSwipe"); BeatAction.New(this, new List() { @@ -238,7 +238,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool //Instantiate(slamFX, this.transform.parent).SetActive(true); mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f); } - + } public void OnMissSwipe(PlayerActionEvent caller) @@ -252,11 +252,11 @@ namespace HeavenStudio.Games.Scripts_DJSchool Sound booSound = SoundByte.PlayOneShotGame("djSchool/boo", caller.timer + caller.startBeat + 1f, 1, 0.8f); CancelInvoke(); canBoo = false; - Invoke("EnableBoo", booSound.clip.length); + Invoke("EnableBoo", 1); } BeatAction.New(game, new List() { - new BeatAction.Action(caller.timer + caller.startBeat + 1f, delegate + new BeatAction.Action(caller.timer + caller.startBeat + 1, delegate { if (game.goBop) { @@ -273,8 +273,6 @@ namespace HeavenStudio.Games.Scripts_DJSchool isHolding = false; missed = true; - //swiping = false; - mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f); BeatAction.New(game, new List() { @@ -290,6 +288,21 @@ namespace HeavenStudio.Games.Scripts_DJSchool }); } + public void OnFlickSwipe() + { + anim.Play("Swipe", 0, 0); + tableAnim.speed = 1; + tableAnim.DoScaledAnimationAsync("Student_Turntable_Swipe", 0.5f); + + isHolding = false; + + missed = true; + mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f); + + OnMissSwipeForPlayerInput(Conductor.instance.songPositionAsDouble + 1); + SoundByte.PlayOneShotGame("djSchool/recordSwipe"); + } + #endregion #region old swipe @@ -351,7 +364,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool flash.color = "D0FBFF".Hex2RGB(); flash.color = new Color(flash.color.r, flash.color.g, flash.color.b, 0.85f); flash.DOColor(new Color(flash.color.r, flash.color.g, flash.color.b, 0), 0.15f); - Destroy(flashFX_, 0.5f); + Destroy(flashFX_, 0.5f); } public void TransitionBackToIdle() diff --git a/Assets/Scripts/Games/Minigame.cs b/Assets/Scripts/Games/Minigame.cs index 8007a7870..fd53c2775 100644 --- a/Assets/Scripts/Games/Minigame.cs +++ b/Assets/Scripts/Games/Minigame.cs @@ -61,7 +61,7 @@ namespace HeavenStudio.Games } protected static bool IA_TouchBasicRelease(out double dt) { - return PlayerInput.GetTouchUp(InputController.ActionsTouch.Tap, out dt); + return PlayerInput.GetTouchUp(InputController.ActionsTouch.Tap, out dt) && !PlayerInput.GetFlick(out _); } protected static bool IA_BatonBasicRelease(out double dt) { diff --git a/Assets/Scripts/Games/PajamaParty/CtrPillowPlayer.cs b/Assets/Scripts/Games/PajamaParty/CtrPillowPlayer.cs index 5e59d8666..d58fdef5f 100644 --- a/Assets/Scripts/Games/PajamaParty/CtrPillowPlayer.cs +++ b/Assets/Scripts/Games/PajamaParty/CtrPillowPlayer.cs @@ -1,4 +1,5 @@ using HeavenStudio.Util; +using HeavenStudio.InputSystem; using System.Collections; using System.Collections.Generic; @@ -33,7 +34,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty double startThrowTime = double.MinValue; float throwLength = 0; float throwHeight = 0; - + bool throwType = true; // true = throw, false = dropped ("Out") bool hasThrown = false; bool throwNg = false; @@ -52,22 +53,33 @@ namespace HeavenStudio.Games.Scripts_PajamaParty { var cond = Conductor.instance; - if (PlayerInput.Pressed() && canJump && !PajamaParty.instance.IsExpectingInputNow(InputType.STANDARD_DOWN)) + if (PlayerInput.GetIsAction(PajamaParty.InputAction_BasicPress) && canJump && !PajamaParty.instance.IsExpectingInputNow(PajamaParty.InputAction_BasicPress)) { - SoundByte.PlayOneShot("miss"); - PlayerJump(cond.songPositionInBeatsAsDouble, true, false); - PajamaParty.instance.ScoreMiss(); + if (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch + || (PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch && !PajamaParty.instance.IsExpectingInputNow(PajamaParty.InputAction_AltStart))) + { + SoundByte.PlayOneShot("miss"); + PlayerJump(cond.songPositionInBeatsAsDouble, true, false); + PajamaParty.instance.ScoreMiss(); + } } - if (PlayerInput.AltPressed() && canCharge) + if (PlayerInput.GetIsAction(PajamaParty.InputAction_AltStart) && canCharge) { StartCharge(); } - if (PlayerInput.AltPressedUp() && charging && !PajamaParty.instance.IsExpectingInputNow(InputType.STANDARD_ALT_UP)) + if (PlayerInput.GetIsAction(PajamaParty.InputAction_AltFinish) + && charging && !PajamaParty.instance.IsExpectingInputNow(PajamaParty.InputAction_AltFinish)) { SoundByte.PlayOneShot("miss"); EndCharge(cond.songPositionInBeatsAsDouble, false, false); PajamaParty.instance.ScoreMiss(); } + if (PlayerInput.GetIsAction(PajamaParty.InputAction_TouchRelease) + && charging && !PajamaParty.instance.IsExpectingInputNow(PajamaParty.InputAction_AltFinish)) + { + SoundByte.PlayOneShot("miss"); + PlayerThrough(cond.songPositionInBeatsAsDouble); + } // mako jumping logic float jumpPos = cond.GetPositionFromBeat(startJumpTime, jumpLength); @@ -75,9 +87,9 @@ namespace HeavenStudio.Games.Scripts_PajamaParty { hasJumped = true; float yMul = jumpPos * 2f - 1f; - float yWeight = -(yMul*yMul) + 1f; + float yWeight = -(yMul * yMul) + 1f; Player.transform.localPosition = new Vector3(0, jumpHeight * yWeight); - Shadow.transform.localScale = new Vector3((1f-yWeight*0.2f) * 1.65f, (1f-yWeight*0.2f), 1f); + Shadow.transform.localScale = new Vector3((1f - yWeight * 0.2f) * 1.65f, (1f - yWeight * 0.2f), 1f); // handles the shirt lifting anim.DoScaledAnimation("MakoJump", startJumpTime, jumpLength); } @@ -110,7 +122,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty { hasThrown = true; float yMul = jumpPos * 2f - 1f; - float yWeight = -(yMul*yMul) + 1f; + float yWeight = -(yMul * yMul) + 1f; Projectile_Root.transform.localPosition = new Vector3(0, throwHeight * yWeight + 0.5f); } else @@ -148,7 +160,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty } } - private void LateUpdate() + private void LateUpdate() { if (Conductor.instance.ReportBeat(ref lastReportedBeat) && anim.IsAnimationNotPlaying() && !hasThrown && !startedSleeping && canCharge && shouldBop) { @@ -212,7 +224,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty { new BeatAction.Action( beat + 0.5f, - delegate { + delegate { anim.DoScaledAnimationAsync("MakoPickUp"); SoundByte.PlayOneShotGame("pajamaParty/catch" + UnityEngine.Random.Range(0, 2)); //bruh Projectile.SetActive(false); @@ -235,7 +247,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty { new BeatAction.Action( beat + 0.5f, - delegate { + delegate { canCharge = true; canJump = true; } @@ -244,129 +256,130 @@ namespace HeavenStudio.Games.Scripts_PajamaParty } // jumping cues (timings for both are the same) - public bool CanJump() - { - return canJump; - } + public bool CanJump() + { + return canJump; + } - public void ScheduleJump(double beat) - { - PajamaParty.instance.ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, JumpJustOrNg, JumpThrough, JumpOut, CanJump); - } + public void ScheduleJump(double beat) + { + PajamaParty.instance.ScheduleInput(beat, 2f, PajamaParty.InputAction_BasicPress, JumpJustOrNg, JumpThrough, JumpOut, CanJump); + } - public void JumpJustOrNg(PlayerActionEvent caller, float state) - { - if (canJump) - { - var cond = Conductor.instance; - if (state <= -1f || state >= 1f) - { - SoundByte.PlayOneShot("miss"); - PlayerJump(cond.songPositionInBeatsAsDouble, false, true); - } - else - { - SoundByte.PlayOneShotGame("pajamaParty/jumpJust"); - PlayerJump(cond.songPositionInBeatsAsDouble, false, false); - } - caller.CanHit(false); - } - } - - public void JumpOut(PlayerActionEvent caller) {} - - public void JumpThrough(PlayerActionEvent caller) - { - if (canJump) - { - var cond = Conductor.instance; - PlayerThrough(cond.songPositionInBeatsAsDouble); - } - } - ////// - - // throw cue - public void ScheduleThrow(double beat) - { - PajamaParty.instance.ScheduleInput(beat, 2f, InputType.STANDARD_ALT_DOWN, ChargeJustOrNg, ThrowThrough, JumpOut); - PajamaParty.instance.ScheduleInput(beat, 3f, InputType.STANDARD_ALT_UP, ThrowJustOrNg, ThrowThrough, JumpOut, CanThrow); - } - - public void ChargeJustOrNg(PlayerActionEvent caller, float state) { - StartCharge(); - throwNg = (state <= -1f || state >= 1f); - SoundByte.PlayOneShotGame("pajamaParty/throw4"); - } - - public bool CanThrow() - { - return charging; - } - - public void ThrowJustOrNg(PlayerActionEvent caller, float state) + public void JumpJustOrNg(PlayerActionEvent caller, float state) + { + if (canJump) { var cond = Conductor.instance; if (state <= -1f || state >= 1f) { SoundByte.PlayOneShot("miss"); - EndCharge(cond.songPositionInBeatsAsDouble, true, true); + PlayerJump(cond.songPositionInBeatsAsDouble, false, true); } else { - SoundByte.PlayOneShotGame("pajamaParty/throw5"); - EndCharge(cond.songPositionInBeatsAsDouble, true, (throwNg || false)); + SoundByte.PlayOneShotGame("pajamaParty/jumpJust"); + PlayerJump(cond.songPositionInBeatsAsDouble, false, false); } caller.CanHit(false); } + } - public void ThrowThrough(PlayerActionEvent caller) + public void JumpOut(PlayerActionEvent caller) { } + + public void JumpThrough(PlayerActionEvent caller) + { + if (canJump) { - if (canCharge) - { - var cond = Conductor.instance; - PlayerThrough(cond.songPositionInBeatsAsDouble); - } + var cond = Conductor.instance; + PlayerThrough(cond.songPositionInBeatsAsDouble); } + } + ////// + + // throw cue + public void ScheduleThrow(double beat) + { + PajamaParty.instance.ScheduleInput(beat, 2f, PajamaParty.InputAction_AltStart, ChargeJustOrNg, ThrowThrough, JumpOut); + PajamaParty.instance.ScheduleInput(beat, 3f, PajamaParty.InputAction_AltFinish, ThrowJustOrNg, ThrowThrough, JumpOut, CanThrow); + } + + public void ChargeJustOrNg(PlayerActionEvent caller, float state) + { + StartCharge(); + throwNg = (state <= -1f || state >= 1f); + SoundByte.PlayOneShotGame("pajamaParty/throw4"); + } + + public bool CanThrow() + { + return charging; + } + + public void ThrowJustOrNg(PlayerActionEvent caller, float state) + { + var cond = Conductor.instance; + if (state <= -1f || state >= 1f) + { + SoundByte.PlayOneShot("miss"); + EndCharge(cond.songPositionInBeatsAsDouble, true, true); + } + else + { + SoundByte.PlayOneShotGame("pajamaParty/throw5"); + EndCharge(cond.songPositionInBeatsAsDouble, true, (throwNg || false)); + } + caller.CanHit(false); + } + + public void ThrowThrough(PlayerActionEvent caller) + { + if (canCharge) + { + var cond = Conductor.instance; + PlayerThrough(cond.songPositionInBeatsAsDouble); + } + } // // sleep cue - public void StartSleepSequence(double beat, bool alt, int action) + public void StartSleepSequence(double beat, bool alt, int action) + { + PajamaParty.instance.ScheduleInput(beat, 4f, PajamaParty.InputAction_BasicPress, SleepJustOrNg, SleepThrough, SleepOut, CanSleep); + + var cond = Conductor.instance; + charging = false; + canCharge = false; + canJump = false; + if (hasJumped) { - PajamaParty.instance.ScheduleInput(beat, 4f, InputType.STANDARD_DOWN, SleepJustOrNg, SleepThrough, SleepOut, CanSleep); + canJump = true; + canCharge = true; + hasJumped = false; + PajamaParty.instance.DoBedImpact(); - var cond = Conductor.instance; - charging = false; - canCharge = false; - canJump = false; - if (hasJumped) - { - canJump = true; - canCharge = true; - hasJumped = false; - PajamaParty.instance.DoBedImpact(); + anim.DoScaledAnimationAsync("MakoLand"); + } + startJumpTime = double.MinValue; + Player.transform.localPosition = new Vector3(0, 0); + Shadow.transform.localScale = new Vector3(1.65f, 1f, 1f); - anim.DoScaledAnimationAsync("MakoLand"); - } - startJumpTime = double.MinValue; - Player.transform.localPosition = new Vector3(0, 0); - Shadow.transform.localScale = new Vector3(1.65f, 1f, 1f); + Projectile.GetComponent().Play("NoPose", -1, 0); + startThrowTime = double.MinValue; + Projectile_Root.transform.localPosition = new Vector3(0, 0); + Projectile.transform.rotation = Quaternion.Euler(0, 0, 0); + if (hasThrown) + { + Projectile.SetActive(false); + hasThrown = false; + } - Projectile.GetComponent().Play("NoPose", -1, 0); - startThrowTime = double.MinValue; - Projectile_Root.transform.localPosition = new Vector3(0, 0); - Projectile.transform.rotation = Quaternion.Euler(0, 0, 0); - if (hasThrown) - { - Projectile.SetActive(false); - hasThrown = false; - } + if (action == (int)PajamaParty.SleepType.NoAwake) + { + longSleep = true; + } - if (action == (int) PajamaParty.SleepType.NoAwake) - { - longSleep = true; - } - - BeatAction.New(this, new List() + BeatAction.New(this, new List() { new BeatAction.Action( beat, @@ -378,83 +391,83 @@ namespace HeavenStudio.Games.Scripts_PajamaParty ), new BeatAction.Action( beat + 1f, - delegate { + delegate { canSleep = true; } ), new BeatAction.Action( beat + 3f, - delegate { + delegate { if (canSleep) anim.DoScaledAnimationAsync(alt ? "MakoReadySleep01" : "MakoReadySleep"); } ), new BeatAction.Action( beat + (longSleep ? 4f : 8f), - delegate { + delegate { canCharge = true; canJump = true; } ), }); - } + } - public bool CanSleep() - { - return canSleep; - } + public bool CanSleep() + { + return canSleep; + } - public void SleepJustOrNg(PlayerActionEvent caller, float state) + public void SleepJustOrNg(PlayerActionEvent caller, float state) + { + var cond = Conductor.instance; + caller.CanHit(false); + canSleep = false; + if (state <= -1f || state >= 1f) + anim.DoUnscaledAnimation("MakoSleepNg"); + else { - var cond = Conductor.instance; - caller.CanHit(false); - canSleep = false; - if (state <= -1f || state >= 1f) - anim.DoUnscaledAnimation("MakoSleepNg"); - else + SoundByte.PlayOneShotGame("pajamaParty/siesta4"); + anim.DoScaledAnimationAsync("MakoSleepJust"); + + if (!longSleep) { - SoundByte.PlayOneShotGame("pajamaParty/siesta4"); - anim.DoScaledAnimationAsync("MakoSleepJust"); - - if (!longSleep) - { - BeatAction.New(this, new List() + BeatAction.New(this, new List() { new BeatAction.Action( caller.startBeat + 7f, - delegate { + delegate { anim.DoScaledAnimationAsync("MakoAwake"); SoundByte.PlayOneShotGame("pajamaParty/siestaDone"); } ), }); - } - longSleep = false; } + longSleep = false; } + } - public void SleepThrough(PlayerActionEvent caller) + public void SleepThrough(PlayerActionEvent caller) + { + var cond = Conductor.instance; + if (canSleep) { - var cond = Conductor.instance; - if (canSleep) - { - anim.DoScaledAnimationAsync("MakoSleepThrough", 1, 0); - caller.CanHit(false); - canSleep = false; - } + anim.DoScaledAnimationAsync("MakoSleepThrough", 1, 0); + caller.CanHit(false); + canSleep = false; } + } - public void SleepOut(PlayerActionEvent caller) + public void SleepOut(PlayerActionEvent caller) + { + var cond = Conductor.instance; + if (canSleep) { - var cond = Conductor.instance; - if (canSleep) - { - anim.DoScaledAnimationAsync("MakoSleepOut", 0.5f); - SoundByte.PlayOneShotGame("pajamaParty/siestaBad"); - caller.CanHit(false); - canSleep = false; - } + anim.DoScaledAnimationAsync("MakoSleepOut", 0.5f); + SoundByte.PlayOneShotGame("pajamaParty/siestaBad"); + caller.CanHit(false); + canSleep = false; } + } ////// } } diff --git a/Assets/Scripts/Games/PajamaParty/PajamaParty.cs b/Assets/Scripts/Games/PajamaParty/PajamaParty.cs index a3d1c0593..8150e4db4 100644 --- a/Assets/Scripts/Games/PajamaParty/PajamaParty.cs +++ b/Assets/Scripts/Games/PajamaParty/PajamaParty.cs @@ -1,4 +1,5 @@ using HeavenStudio.Util; +using HeavenStudio.InputSystem; using System.Collections; using System.Collections.Generic; @@ -111,6 +112,42 @@ namespace HeavenStudio.Games NoAwake, } + const int IAAltDownCat = 4; + const int IAAltUpCat = 5; + + protected static bool IA_PadAltPress(out double dt) + { + return PlayerInput.GetPadDown(InputController.ActionsPad.South, out dt); + } + protected static bool IA_BatonAltPress(out double dt) + { + return PlayerInput.GetSqueezeDown(out dt); + } + protected static bool IA_TouchAltPress(out double dt) + { + return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt) + && instance.IsExpectingInputNow(InputAction_AltStart); + } + + protected static bool IA_PadAltRelease(out double dt) + { + return PlayerInput.GetPadUp(InputController.ActionsPad.South, out dt); + } + protected static bool IA_BatonAltRelease(out double dt) + { + return PlayerInput.GetSqueezeUp(out dt); + } + + public static PlayerInput.InputAction InputAction_AltStart = + new("CtrPillowAltStart", new int[] { IAAltDownCat, IAAltDownCat, IAAltDownCat }, + IA_PadAltPress, IA_TouchAltPress, IA_BatonAltPress); + public static PlayerInput.InputAction InputAction_AltFinish = + new("CtrPillowAltFinish", new int[] { IAAltUpCat, IAFlickCat, IAAltUpCat }, + IA_PadAltRelease, IA_TouchFlick, IA_BatonAltRelease); + public static PlayerInput.InputAction InputAction_TouchRelease = + new("CtrPillowTouchRelease", new int[] { IAEmptyCat, IAReleaseCat, IAEmptyCat }, + IA_Empty, IA_TouchBasicRelease, IA_Empty); + void Awake() { instance = this; diff --git a/Assets/Scripts/Games/PlayerActionEvent.cs b/Assets/Scripts/Games/PlayerActionEvent.cs index 8e200373c..c08ffcb35 100644 --- a/Assets/Scripts/Games/PlayerActionEvent.cs +++ b/Assets/Scripts/Games/PlayerActionEvent.cs @@ -134,10 +134,10 @@ namespace HeavenStudio.Games normalizedTime -= dt; if (IsExpectingInputNow()) { - if (InputAction != null) - { - Debug.Log("Hit " + InputAction.name); - } + // if (InputAction != null) + // { + // Debug.Log("Hit " + InputAction.name); + // } double stateProg = ((normalizedTime - Minigame.JustEarlyTime()) / (Minigame.JustLateTime() - Minigame.JustEarlyTime()) - 0.5f) * 2; Hit(stateProg, normalizedTime); } diff --git a/Assets/Scripts/Games/SamuraiSliceNtr/NtrSamuraiObject.cs b/Assets/Scripts/Games/SamuraiSliceNtr/NtrSamuraiObject.cs index 8ae006333..bbb681385 100644 --- a/Assets/Scripts/Games/SamuraiSliceNtr/NtrSamuraiObject.cs +++ b/Assets/Scripts/Games/SamuraiSliceNtr/NtrSamuraiObject.cs @@ -82,11 +82,11 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai break; } - launchProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat, 2f, InputType.STANDARD_ALT_DOWN, LaunchSuccess, LaunchMiss, LaunchThrough); + launchProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat, 2f, SamuraiSliceNtr.InputAction_AltDown, LaunchSuccess, LaunchMiss, LaunchThrough); //autoplay: launch anim - SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat, 2f, InputType.STANDARD_ALT_DOWN, DoLaunchAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false; + SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat, 2f, SamuraiSliceNtr.InputAction_AltDown, DoLaunchAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false; //autoplay: unstep - SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat, 1.75f, InputType.STANDARD_ALT_UP, DoUnStepAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false; + SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat, 1.75f, SamuraiSliceNtr.InputAction_AltUp, DoUnStepAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false; currentCurve = SamuraiSliceNtr.instance.InCurve; transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (360f * (float) startBeat)); @@ -206,8 +206,8 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai if (flyProg == 2) { flyProg = 1; - hitProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat + 4f, 2f, InputType.STANDARD_DOWN, HitSuccess, HitMiss, LaunchThrough); - SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 4f, 2f, InputType.STANDARD_DOWN, DoSliceAutoplay, LaunchThrough, LaunchThrough); + hitProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat + 4f, 2f, SamuraiSliceNtr.InputAction_FlickPress, HitSuccess, HitMiss, LaunchThrough); + SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 4f, 2f, SamuraiSliceNtr.InputAction_FlickPress, DoSliceAutoplay, LaunchThrough, LaunchThrough); currentCurve = SamuraiSliceNtr.instance.LaunchCurve; SoundByte.PlayOneShotGame("samuraiSliceNtr/holy_mackerel" + UnityEngine.Random.Range(1, 4), pitch: UnityEngine.Random.Range(0.95f, 1.05f), volume: 1f/4); @@ -215,10 +215,10 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai else { flyProg = 2; - launchProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat + 2f, 2f, InputType.STANDARD_ALT_DOWN, LaunchSuccess, LaunchMiss, LaunchThrough); - SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 2f, InputType.STANDARD_ALT_DOWN, DoLaunchAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false; + launchProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat + 2f, 2f, SamuraiSliceNtr.InputAction_AltDown, LaunchSuccess, LaunchMiss, LaunchThrough); + SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 2f, SamuraiSliceNtr.InputAction_AltDown, DoLaunchAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false; //autoplay: unstep - SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 1.75f, InputType.STANDARD_ALT_UP, DoUnStepAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false; + SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 1.75f, SamuraiSliceNtr.InputAction_AltUp, DoUnStepAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false; currentCurve = null; SoundByte.PlayOneShotGame("samuraiSliceNtr/holy_mackerel" + UnityEngine.Random.Range(1, 4), pitch: UnityEngine.Random.Range(0.95f, 1.05f), volume: 0.8f); @@ -226,14 +226,14 @@ namespace HeavenStudio.Games.Scripts_NtrSamurai break; case (int) SamuraiSliceNtr.ObjectType.Demon: flyProg = 1; - hitProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat + 2f, 4f, InputType.STANDARD_DOWN, HitSuccess, HitMiss, LaunchThrough); - SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 4f, InputType.STANDARD_DOWN, DoSliceAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false; + hitProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat + 2f, 4f, SamuraiSliceNtr.InputAction_FlickPress, HitSuccess, HitMiss, LaunchThrough); + SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 4f, SamuraiSliceNtr.InputAction_FlickPress, DoSliceAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false; currentCurve = SamuraiSliceNtr.instance.LaunchHighCurve; break; default: flyProg = 1; - hitProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat + 2f, 2f, InputType.STANDARD_DOWN, HitSuccess, HitMiss, LaunchThrough); - SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 2f, InputType.STANDARD_DOWN, DoSliceAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false; + hitProg = SamuraiSliceNtr.instance.ScheduleInput(startBeat + 2f, 2f, SamuraiSliceNtr.InputAction_FlickPress, HitSuccess, HitMiss, LaunchThrough); + SamuraiSliceNtr.instance.ScheduleAutoplayInput(startBeat + 2f, 2f, SamuraiSliceNtr.InputAction_FlickPress, DoSliceAutoplay, LaunchThrough, LaunchThrough).countsForAccuracy = false; currentCurve = SamuraiSliceNtr.instance.LaunchCurve; break; } diff --git a/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs b/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs index b443e405e..397a11225 100644 --- a/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs +++ b/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs @@ -1,4 +1,5 @@ using HeavenStudio.Util; +using HeavenStudio.InputSystem; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -131,6 +132,38 @@ namespace HeavenStudio.Games public GameEvent bop = new GameEvent(); + const int IAAltDownCat = 4; + const int IAAltUpCat = 5; + + protected static bool IA_PadAltPress(out double dt) + { + return PlayerInput.GetPadDown(InputController.ActionsPad.South, out dt); + } + protected static bool IA_BatonAltPress(out double dt) + { + return PlayerInput.GetSqueezeDown(out dt); + } + protected static bool IA_TouchAltPress(out double dt) + { + return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt); + } + + protected static bool IA_PadAltRelease(out double dt) + { + return PlayerInput.GetPadUp(InputController.ActionsPad.South, out dt); + } + protected static bool IA_BatonAltRelease(out double dt) + { + return PlayerInput.GetSqueezeUp(out dt); + } + + public static PlayerInput.InputAction InputAction_AltDown = + new("NtrSamuraiAltDown", new int[] { IAAltDownCat, IAAltDownCat, IAAltDownCat }, + IA_PadAltPress, IA_TouchAltPress, IA_BatonAltPress); + public static PlayerInput.InputAction InputAction_AltUp = + new("NtrSamuraiAltUp", new int[] { IAAltUpCat, IAFlickCat, IAAltUpCat }, + IA_PadAltRelease, IA_TouchBasicRelease, IA_BatonAltRelease); + private void Awake() { instance = this; @@ -146,11 +179,11 @@ namespace HeavenStudio.Games if (goBopChild) childParent.GetComponent().Bop(); } - if (PlayerInput.AltPressed()) + if (PlayerInput.GetIsAction(InputAction_AltDown)) DoStep(); - if (PlayerInput.AltPressedUp() && player.isStepping()) + if (PlayerInput.GetIsAction(InputAction_AltUp) && player.isStepping()) DoUnStep(); - if (PlayerInput.Pressed()) + if (PlayerInput.GetIsAction(InputAction_FlickPress)) DoSlice(); } diff --git a/Assets/Scripts/Games/Splashdown/Splashdown.cs b/Assets/Scripts/Games/Splashdown/Splashdown.cs index fba15b14f..70f33da75 100644 --- a/Assets/Scripts/Games/Splashdown/Splashdown.cs +++ b/Assets/Scripts/Games/Splashdown/Splashdown.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using HeavenStudio.Util; +using HeavenStudio.InputSystem; using System; namespace HeavenStudio.Games.Loaders @@ -105,14 +106,16 @@ namespace HeavenStudio.Games if (cond.isPlaying && !cond.isPaused && !IsIntroing()) { - if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) + if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress)) { SoundByte.PlayOneShot("miss"); SoundByte.PlayOneShotGame("splashdown/downPlayer"); player.GoDown(); ScoreMiss(); } - if (PlayerInput.PressedUp() && !IsExpectingInputNow(InputType.STANDARD_UP)) + + if ((PlayerInput.GetIsAction(InputAction_BasicRelease) && !IsExpectingInputNow(InputAction_BasicRelease)) + || (PlayerInput.GetIsAction(InputAction_FlickRelease) && !IsExpectingInputNow(InputAction_FlickRelease))) { SoundByte.PlayOneShot("miss"); player.Appear(true); @@ -198,7 +201,7 @@ namespace HeavenStudio.Games } BeatAction.New(instance, actions); SoundByte.PlayOneShotGame("splashdown/whistle", beat + (currentSynchrettes.Count * length)); - ScheduleInput(beat, currentSynchrettes.Count * length, InputType.STANDARD_DOWN, JustDown, Out, Out); + ScheduleInput(beat, currentSynchrettes.Count * length, InputAction_BasicPress, JustDown, Out, Out); } public void GoUp(double beat, float length, int appearType) @@ -221,13 +224,13 @@ namespace HeavenStudio.Games switch (appearType) { case 1: - ScheduleInput(beat, currentSynchrettes.Count * length, InputType.STANDARD_UP, JustUp1, Out, Out); + ScheduleInput(beat, currentSynchrettes.Count * length, InputAction_BasicRelease, JustUp1, Out, Out); break; case 2: - ScheduleInput(beat, currentSynchrettes.Count * length, InputType.STANDARD_UP, JustUp2, Out, Out); + ScheduleInput(beat, currentSynchrettes.Count * length, InputAction_BasicRelease, JustUp2, Out, Out); break; case 3: - ScheduleInput(beat, currentSynchrettes.Count * length, InputType.STANDARD_UP, JustUp3, Out, Out); + ScheduleInput(beat, currentSynchrettes.Count * length, InputAction_BasicRelease, JustUp3, Out, Out); break; } } @@ -251,7 +254,7 @@ namespace HeavenStudio.Games } BeatAction.New(instance, actions); SoundByte.PlayOneShotGame("splashdown/yeah", beat + (currentSynchrettes.Count * length)); - ScheduleInput(beat, currentSynchrettes.Count * length, InputType.STANDARD_UP, dolphin ? JustJump : JustJumpNoDolphin, Out, Out); + ScheduleInput(beat, currentSynchrettes.Count * length, InputAction_FlickRelease, dolphin ? JustJump : JustJumpNoDolphin, Out, Out); } public void TogetherJump(double beat, bool alleyoop) @@ -288,7 +291,7 @@ namespace HeavenStudio.Games new MultiSound.Sound("splashdown/splashOthers", beat + 3.75), }); } - ScheduleInput(beat, 2, InputType.STANDARD_UP, alleyoop ? JustJumpNoRollSound : JustJump, Out, Out); + ScheduleInput(beat, 2, InputAction_FlickRelease, alleyoop ? JustJumpNoRollSound : JustJump, Out, Out); } public void TogetherJumpRemix9(double beat, bool alleyoop) @@ -325,7 +328,7 @@ namespace HeavenStudio.Games new MultiSound.Sound("splashdown/splashOthers", beat + 2.75), }); } - ScheduleInput(beat, 1, InputType.STANDARD_UP, alleyoop ? JustJumpNoRollSound : JustJump, Out, Out); + ScheduleInput(beat, 1, InputAction_FlickRelease, alleyoop ? JustJumpNoRollSound : JustJump, Out, Out); } private void JustDown(PlayerActionEvent caller, float state) diff --git a/Assets/Scripts/Games/TheDazzles/TheDazzles.cs b/Assets/Scripts/Games/TheDazzles/TheDazzles.cs index 809fbce26..b1ef7e9a6 100644 --- a/Assets/Scripts/Games/TheDazzles/TheDazzles.cs +++ b/Assets/Scripts/Games/TheDazzles/TheDazzles.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using UnityEngine; using HeavenStudio.Util; +using HeavenStudio.InputSystem; namespace HeavenStudio.Games.Loaders { @@ -237,6 +238,10 @@ namespace HeavenStudio.Games [SerializeField] ParticleSystem poseEffect; [SerializeField] ParticleSystem starsEffect; + public static PlayerInput.InputAction InputAction_TouchRelease = + new("NtrBoxshowTouchRelease", new int[] { IAEmptyCat, IAReleaseCat, IAEmptyCat }, + IA_Empty, IA_TouchBasicRelease, IA_Empty); + void OnDestroy() { if (queuedPoses.Count > 0) queuedPoses.Clear(); @@ -285,7 +290,8 @@ namespace HeavenStudio.Games } queuedCrouches.Clear(); } - if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) + + if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress)) { player.Prepare(false); SoundByte.PlayOneShotGame("theDazzles/miss"); @@ -294,15 +300,18 @@ namespace HeavenStudio.Games if (girl.currentEmotion != TheDazzlesGirl.Emotion.Ouch) girl.currentEmotion = TheDazzlesGirl.Emotion.Angry; } } - if (PlayerInput.PressedUp() && !IsExpectingInputNow(InputType.STANDARD_UP)) + if (PlayerInput.GetIsAction(InputAction_FlickRelease) && !IsExpectingInputNow(InputAction_FlickRelease)) { - if (doingPoses) + if (doingPoses || PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch) { - player.Pose(false); + player.Pose(false, doingPoses); SoundByte.PlayOneShotGame("theDazzles/miss"); - foreach (var girl in npcGirls) + if (doingPoses) { - girl.Ouch(); + foreach (var girl in npcGirls) + { + girl.Ouch(); + } } } else @@ -311,7 +320,12 @@ namespace HeavenStudio.Games } shouldHold = false; } - else if (!PlayerInput.Pressing() && !IsExpectingInputNow(InputType.STANDARD_UP) && shouldHold && !GameManager.instance.autoplay) + if (PlayerInput.GetIsAction(InputAction_TouchRelease) && !GameManager.instance.autoplay) + { + player.UnPrepare(); + shouldHold = false; + } + if (PlayerInput.GetIsAction(InputAction_BasicRelease) && shouldHold && !GameManager.instance.autoplay) { if (doingPoses) { @@ -410,7 +424,7 @@ namespace HeavenStudio.Games { float actualLength = length / 3; crouchEndBeat = beat + length; - ScheduleInput(beat, 2f * actualLength, InputType.STANDARD_DOWN, JustCrouch, Nothing, Nothing); + ScheduleInput(beat, 2f * actualLength, InputAction_BasicPress, JustCrouch, Nothing, Nothing); BeatAction.New(instance, new List() { @@ -453,11 +467,11 @@ namespace HeavenStudio.Games { if (stars) { - ScheduleInput(beat, playerBeat, InputType.STANDARD_UP, cheer ? JustPoseStars : JustPoseStarsNoCheer, MissPose, Nothing); + ScheduleInput(beat, playerBeat, InputAction_FlickRelease, cheer ? JustPoseStars : JustPoseStarsNoCheer, MissPose, Nothing); } else { - ScheduleInput(beat, playerBeat, InputType.STANDARD_UP, cheer ? JustPose : JustPoseNoCheer, MissPose, Nothing); + ScheduleInput(beat, playerBeat, InputAction_FlickRelease, cheer ? JustPose : JustPoseNoCheer, MissPose, Nothing); } double crouchBeat = beat - 1f; if (crouchBeat < crouchEndBeat) diff --git a/Assets/Scripts/Games/TheDazzles/TheDazzlesGirl.cs b/Assets/Scripts/Games/TheDazzles/TheDazzlesGirl.cs index 0e608cf76..da364e92e 100644 --- a/Assets/Scripts/Games/TheDazzles/TheDazzlesGirl.cs +++ b/Assets/Scripts/Games/TheDazzles/TheDazzlesGirl.cs @@ -73,7 +73,7 @@ namespace HeavenStudio.Games.Scripts_TheDazzles }); } - public void Pose(bool hit = true) + public void Pose(bool hit = true, bool flash = true) { if (hit) { @@ -84,7 +84,8 @@ namespace HeavenStudio.Games.Scripts_TheDazzles else { anim.DoScaledAnimationAsync("MissPose", 0.5f); - lightingAnim.DoScaledAnimationAsync("MissFlash", 0.5f); + if (flash) + lightingAnim.DoScaledAnimationAsync("MissFlash", 0.5f); currentEmotion = Emotion.Ouch; hasOuched = true; } diff --git a/Assets/Scripts/Util/AnimationHelpers.cs b/Assets/Scripts/Util/AnimationHelpers.cs index efffab5d8..7b9fd66f2 100644 --- a/Assets/Scripts/Util/AnimationHelpers.cs +++ b/Assets/Scripts/Util/AnimationHelpers.cs @@ -30,9 +30,10 @@ namespace HeavenStudio.Util /// duration of animation (progress 1.0) /// multiplier for animation progress (smaller values make animation slower) /// animator layer to play animation on - public static void DoScaledAnimation(this Animator anim, string animName, double startTime, float length = 1f, float timeScale = 1f, int animLayer = -1) + public static void DoScaledAnimation(this Animator anim, string animName, double startTime, float length = 1f, float timeScale = 1f, int animLayer = -1, bool clamp = false) { float pos = Conductor.instance.GetPositionFromBeat(startTime, length) * timeScale; + if (clamp) pos = Mathf.Clamp01(pos); anim.Play(animName, animLayer, pos); anim.speed = 1f; //not 0 so these can still play their script events }