From e4aa90def4575b20b64512bcbe13ea264472db43 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Thu, 21 Sep 2023 23:46:29 -0400 Subject: [PATCH] last of the easy games' touch --- Assets/Scripts/Games/CatchyTune/CatchyTune.cs | 8 +-- Assets/Scripts/Games/DogNinja/DogNinja.cs | 4 +- .../Scripts/Games/Kitties/CtrTeppanPlayer.cs | 35 ++++++----- Assets/Scripts/Games/Kitties/Kitties.cs | 44 ++++++++++++-- Assets/Scripts/Games/RhythmTweezers/Hair.cs | 2 +- .../Scripts/Games/RhythmTweezers/LongHair.cs | 6 +- .../Games/RhythmTweezers/RhythmTweezers.cs | 30 ++++++++++ .../Scripts/Games/RhythmTweezers/Tweezers.cs | 19 +++--- Assets/Scripts/Games/TapTrial/TapTrial.cs | 41 ++++++------- .../Scripts/Games/TapTrial/TapTrialPlayer.cs | 2 +- Assets/Scripts/Games/TapTroupe/TapTroupe.cs | 6 +- .../Games/TramAndPauline/TramAndPauline.cs | 60 ++++++++++++++++++- Assets/Scripts/Games/Tunnel/Tunnel.cs | 4 +- Assets/Scripts/Games/WizardsWaltz/Plant.cs | 2 +- Assets/Scripts/Games/WizardsWaltz/Wizard.cs | 2 +- .../Games/WizardsWaltz/WizardsWaltz.cs | 13 ++++ 16 files changed, 207 insertions(+), 71 deletions(-) diff --git a/Assets/Scripts/Games/CatchyTune/CatchyTune.cs b/Assets/Scripts/Games/CatchyTune/CatchyTune.cs index 14aa700b1..628b35e68 100644 --- a/Assets/Scripts/Games/CatchyTune/CatchyTune.cs +++ b/Assets/Scripts/Games/CatchyTune/CatchyTune.cs @@ -146,8 +146,8 @@ namespace HeavenStudio.Games if (!want) { simul = PlayerInput.GetTouchDown(InputController.ActionsTouch.Right, out dt) - && instance.IsExpectingInputNow(InputAction_Left.inputLockCategory) - && instance.IsExpectingInputNow(InputAction_Right.inputLockCategory); + && instance.IsExpectingInputNow(InputAction_Left) + && instance.IsExpectingInputNow(InputAction_Right); } return want || simul; } @@ -167,8 +167,8 @@ namespace HeavenStudio.Games if (!want) { simul = PlayerInput.GetTouchDown(InputController.ActionsTouch.Left, out dt) - && instance.IsExpectingInputNow(InputAction_Left.inputLockCategory) - && instance.IsExpectingInputNow(InputAction_Right.inputLockCategory); + && instance.IsExpectingInputNow(InputAction_Left) + && instance.IsExpectingInputNow(InputAction_Right); } return want || simul; } diff --git a/Assets/Scripts/Games/DogNinja/DogNinja.cs b/Assets/Scripts/Games/DogNinja/DogNinja.cs index 1093fbf97..b4139bb1c 100644 --- a/Assets/Scripts/Games/DogNinja/DogNinja.cs +++ b/Assets/Scripts/Games/DogNinja/DogNinja.cs @@ -297,7 +297,7 @@ namespace HeavenStudio.Games sfxNumR = sfxNumR, }); - prepare = prepare && PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch; + prepare = prepare && PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch && PlayerInput.PlayerHasControl(); if (prepare) DogNinja.instance.DogAnim.SetBool("needPrepare", true); } @@ -348,7 +348,7 @@ namespace HeavenStudio.Games public void Prepare(double beat) { - if (PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch) return; + if (PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch && PlayerInput.PlayerHasControl()) return; if (!DogAnim.GetBool("needPrepare")) DogAnim.DoScaledAnimationAsync("Prepare", 0.5f); DogAnim.SetBool("needPrepare", true); } diff --git a/Assets/Scripts/Games/Kitties/CtrTeppanPlayer.cs b/Assets/Scripts/Games/Kitties/CtrTeppanPlayer.cs index d709d82d1..900f590d6 100644 --- a/Assets/Scripts/Games/Kitties/CtrTeppanPlayer.cs +++ b/Assets/Scripts/Games/Kitties/CtrTeppanPlayer.cs @@ -18,7 +18,7 @@ namespace HeavenStudio.Games.Scripts_Kitties private bool hasClapped = false; public bool canClap = false; - private bool hasSpun = true; + private bool hasSpun = false; private bool checkSpin = false; private bool hasFish = false; @@ -34,17 +34,21 @@ namespace HeavenStudio.Games.Scripts_Kitties { var cond = Conductor.instance; - if (PlayerInput.Pressed() && canClap && !Kitties.instance.IsExpectingInputNow(InputType.STANDARD_DOWN)) + if (PlayerInput.GetIsAction(Kitties.InputAction_BasicPress) && canClap && !Kitties.instance.IsExpectingInputNow(Kitties.InputAction_BasicPress)) { - SoundByte.PlayOneShot("miss"); - if (spawnType != 3) - anim.Play("ClapFail", 0, 0); - else - anim.Play("FaceClapFail", 0, 0); + if (PlayerInput.CurrentControlStyle == InputSystem.InputController.ControlStyles.Touch && !Kitties.instance.IsExpectingInputNow(Kitties.InputAction_AltStart)) + { + SoundByte.PlayOneShot("miss"); + if (spawnType != 3) + anim.Play("ClapFail", 0, 0); + else + anim.Play("FaceClapFail", 0, 0); + } } - if (PlayerInput.AltPressed() && canClap && !Kitties.instance.IsExpectingInputNow(InputType.STANDARD_ALT_DOWN) - || PlayerInput.AltPressedUp() && canClap && !Kitties.instance.IsExpectingInputNow(InputType.STANDARD_ALT_UP) && hasSpun) + if ((PlayerInput.GetIsAction(Kitties.InputAction_AltStart) && canClap && !(Kitties.instance.IsExpectingInputNow(Kitties.InputAction_AltStart) || Kitties.instance.IsExpectingInputNow(Kitties.InputAction_BasicPress))) + || (PlayerInput.GetIsAction(Kitties.InputAction_AltFinish) && canClap && !Kitties.instance.IsExpectingInputNow(Kitties.InputAction_AltFinish) && hasSpun) + || ((PlayerInput.GetIsAction(Kitties.InputAction_TouchRelease) && !PlayerInput.GetIsAction(Kitties.InputAction_AltFinish)) && canClap && hasSpun)) { RollFail(); } @@ -53,25 +57,24 @@ namespace HeavenStudio.Games.Scripts_Kitties public void ScheduleClap(double beat, int type) { spawnType = type; - Kitties.instance.ScheduleInput(beat, 2.5f, InputType.STANDARD_DOWN, ClapSuccessOne, ClapMissOne, ClapEmpty); - Kitties.instance.ScheduleInput(beat, 3f, InputType.STANDARD_DOWN, ClapSuccessTwo, ClapMissTwo, ClapEmpty); + Kitties.instance.ScheduleInput(beat, 2.5f, Kitties.InputAction_BasicPress, ClapSuccessOne, ClapMissOne, ClapEmpty); + Kitties.instance.ScheduleInput(beat, 3f, Kitties.InputAction_BasicPress, ClapSuccessTwo, ClapMissTwo, ClapEmpty); } public void ScheduleRoll(double beat) { - Kitties.instance.ScheduleInput(beat, 2f, InputType.STANDARD_ALT_DOWN, SpinSuccessOne, SpinMissOne, SpinEmpty); + Kitties.instance.ScheduleInput(beat, 2f, Kitties.InputAction_AltStart, SpinSuccessOne, SpinMissOne, SpinEmpty); } public void ScheduleRollFinish(double beat) { - Debug.Log(hasSpun); if (hasSpun) - Kitties.instance.ScheduleInput(beat, 2.75f, InputType.STANDARD_ALT_UP, SpinSuccessTwo, SpinMissTwo, SpinEmpty); + Kitties.instance.ScheduleInput(beat, 2.75f, Kitties.InputAction_AltFinish, SpinSuccessTwo, SpinMissTwo, SpinEmpty); } public void ScheduleFish(double beat) { - Kitties.instance.ScheduleInput(beat, 2.75f, InputType.STANDARD_DOWN, FishSuccess, FishMiss, FishEmpty); + Kitties.instance.ScheduleInput(beat, 2.75f, Kitties.InputAction_BasicPress, FishSuccess, FishMiss, FishEmpty); } public void ClapSuccessOne(PlayerActionEvent Caller, float state) @@ -152,12 +155,14 @@ namespace HeavenStudio.Games.Scripts_Kitties hasSpun = true; SoundByte.PlayOneShotGame("kitties/roll5"); anim.Play("Rolling", 0, 0); + ScheduleRollFinish(caller.startBeat); } public void SpinSuccessTwo(PlayerActionEvent caller, float beat) { SoundByte.PlayOneShotGame("kitties/roll6"); anim.Play("RollEnd", 0, 0); + hasSpun = false; } public void SpinMissOne(PlayerActionEvent caller) diff --git a/Assets/Scripts/Games/Kitties/Kitties.cs b/Assets/Scripts/Games/Kitties/Kitties.cs index be43f5d14..d109ab58a 100644 --- a/Assets/Scripts/Games/Kitties/Kitties.cs +++ b/Assets/Scripts/Games/Kitties/Kitties.cs @@ -1,4 +1,5 @@ using HeavenStudio.Util; +using HeavenStudio.InputSystem; using System; using System.Collections.Generic; using UnityEngine; @@ -110,6 +111,42 @@ namespace HeavenStudio.Games public static Kitties instance; + 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("CtrTeppanAltStart", new int[] { IAAltDownCat, IAAltDownCat, IAAltDownCat }, + IA_PadAltPress, IA_TouchAltPress, IA_BatonAltPress); + public static PlayerInput.InputAction InputAction_AltFinish = + new("CtrTeppanAltFinish", new int[] { IAAltUpCat, IAFlickCat, IAAltUpCat }, + IA_PadAltRelease, IA_TouchFlick, IA_BatonAltRelease); + public static PlayerInput.InputAction InputAction_TouchRelease = + new("CtrTeppanTouchRelease", new int[] { IAEmptyCat, IAReleaseCat, IAEmptyCat }, + IA_Empty, IA_TouchBasicRelease, IA_Empty); + void Awake() { instance = this; @@ -229,7 +266,7 @@ namespace HeavenStudio.Games new BeatAction.Action(beat + 1.5f, delegate { kitties[0].Play("RollStart", 0, 0); }), new BeatAction.Action(beat + 2f, delegate { kitties[0].Play("Rolling", 0, 0); }), new BeatAction.Action(beat + 2.75f, delegate { kitties[0].Play("RollEnd", 0, 0); }) - }); + }); BeatAction.New(instance, new List() { @@ -246,9 +283,8 @@ namespace HeavenStudio.Games new BeatAction.Action(beat, delegate { kitties[2].Play("RollStart", 0, 0); }), new BeatAction.Action(beat + .5f, delegate { kitties[2].Play("RollStart", 0, 0); }), new BeatAction.Action(beat + 1f, delegate { kitties[2].Play("RollStart", 0, 0); }), - new BeatAction.Action(beat + 1.5f, delegate { kitties[2].Play("RollStart", 0, 0); }), - new BeatAction.Action(beat + 2f, delegate { player.ScheduleRollFinish(beat); }) - }); + new BeatAction.Action(beat + 1.5f, delegate { kitties[2].Play("RollStart", 0, 0); }) + }); if (!keepSpawned) { diff --git a/Assets/Scripts/Games/RhythmTweezers/Hair.cs b/Assets/Scripts/Games/RhythmTweezers/Hair.cs index 9c19bd4ff..0393d3437 100644 --- a/Assets/Scripts/Games/RhythmTweezers/Hair.cs +++ b/Assets/Scripts/Games/RhythmTweezers/Hair.cs @@ -18,7 +18,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers { game = RhythmTweezers.instance; tweezers = tweezer; - game.ScheduleInput(beat, length, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, Just, Miss, Out); + game.ScheduleInput(beat, length, RhythmTweezers.InputAction_Press, Just, Miss, Out); } public void Ace() diff --git a/Assets/Scripts/Games/RhythmTweezers/LongHair.cs b/Assets/Scripts/Games/RhythmTweezers/LongHair.cs index f919d715d..9073b8137 100644 --- a/Assets/Scripts/Games/RhythmTweezers/LongHair.cs +++ b/Assets/Scripts/Games/RhythmTweezers/LongHair.cs @@ -32,7 +32,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers anim = GetComponent(); tweezers = tweezer; inputBeat = beat + length; - game.ScheduleInput(beat, length, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, StartJust, StartMiss, Out); + game.ScheduleInput(beat, length, RhythmTweezers.InputAction_Press, StartJust, StartMiss, Out); } private void Update() @@ -46,7 +46,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers float normalizedBeat = Conductor.instance.GetPositionFromBeat(inputBeat, 0.5f); anim.Play("LoopPull", 0, normalizedBeat); tweezers.anim.Play("Tweezers_LongPluck", 0, normalizedBeat); - if (!game.IsExpectingInputNow(InputType.STANDARD_UP | InputType.DIRECTION_DOWN_UP) && (PlayerInput.PressedUp() || PlayerInput.GetAnyDirectionUp()) && normalizedBeat < 1f) + if (!game.IsExpectingInputNow(RhythmTweezers.InputAction_Release) && PlayerInput.GetIsAction(RhythmTweezers.InputAction_Release) && normalizedBeat < 1f) { EndEarly(); endEvent.Disable(); @@ -92,7 +92,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers } pullSound = SoundByte.PlayOneShotGame($"rhythmTweezers/longPull{UnityEngine.Random.Range(1, 5)}"); pluckState = 1; - endEvent = game.ScheduleInput(inputBeat, 0.5f, InputType.STANDARD_UP | InputType.DIRECTION_DOWN_UP, EndJust, Out, Out); + endEvent = game.ScheduleInput(inputBeat, 0.5f, RhythmTweezers.InputAction_Release, EndJust, Out, Out); } private void StartMiss(PlayerActionEvent caller) diff --git a/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs b/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs index 66ca802c4..48fd78738 100644 --- a/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs +++ b/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs @@ -5,6 +5,7 @@ using System; using Starpelly; using DG.Tweening; using HeavenStudio.Util; +using HeavenStudio.InputSystem; namespace HeavenStudio.Games.Loaders { @@ -208,6 +209,35 @@ namespace HeavenStudio.Games } private static List queuedIntervals = new List(); + protected static bool IA_PadAnyDown(out double dt) + { + return PlayerInput.GetPadDown(InputController.ActionsPad.East, out dt) + || PlayerInput.GetPadDown(InputController.ActionsPad.Up, out dt) + || PlayerInput.GetPadDown(InputController.ActionsPad.Down, out dt) + || PlayerInput.GetPadDown(InputController.ActionsPad.Left, out dt) + || PlayerInput.GetPadDown(InputController.ActionsPad.Right, out dt); + } + protected static bool IA_PadAnyUp(out double dt) + { + bool face = PlayerInput.GetPadUp(InputController.ActionsPad.East, out dt) + && !(PlayerInput.GetPad(InputController.ActionsPad.Up) + || PlayerInput.GetPad(InputController.ActionsPad.Down) + || PlayerInput.GetPad(InputController.ActionsPad.Left) + || PlayerInput.GetPad(InputController.ActionsPad.Right)); + bool pad = (PlayerInput.GetPadUp(InputController.ActionsPad.Up) + || PlayerInput.GetPadUp(InputController.ActionsPad.Down) + || PlayerInput.GetPadUp(InputController.ActionsPad.Left) + || PlayerInput.GetPadUp(InputController.ActionsPad.Right)) + && !PlayerInput.GetPad(InputController.ActionsPad.East); + return face || pad; + } + public static PlayerInput.InputAction InputAction_Press = + new("AgbHairPress", new int[] { IAPressCat, IAPressCat, IAPressCat }, + IA_PadAnyDown, IA_TouchBasicPress, IA_BatonBasicPress); + public static PlayerInput.InputAction InputAction_Release = + new("AgbHairRelease", new int[] { IAReleaseCat, IAReleaseCat, IAReleaseCat }, + IA_PadAnyUp, IA_TouchBasicRelease, IA_BatonBasicRelease); + private void Awake() { instance = this; diff --git a/Assets/Scripts/Games/RhythmTweezers/Tweezers.cs b/Assets/Scripts/Games/RhythmTweezers/Tweezers.cs index eb3199d2c..ce793f069 100644 --- a/Assets/Scripts/Games/RhythmTweezers/Tweezers.cs +++ b/Assets/Scripts/Games/RhythmTweezers/Tweezers.cs @@ -60,20 +60,15 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers Destroy(gameObject); } } + if (PlayerInput.GetIsAction(RhythmTweezers.InputAction_Press) && !game.IsExpectingInputNow(RhythmTweezers.InputAction_Press)) + { + DropHeldHair(); + anim.Play("Tweezers_Pluck", 0, 0); + } } private void LateUpdate() { - if (PlayerInput.Pressed() || PlayerInput.GetAnyDirectionDown()) - { - if (!pluckingThisFrame) // Did you do a successful pluck earlier in the frame? - { - DropHeldHair(); - anim.Play("Tweezers_Pluck", 0, 0); - } - } - - pluckingThisFrame = false; } public void Pluck(bool ace, Hair hair) @@ -110,7 +105,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers anim.Play("Tweezers_Pluck_Fail", 0, 0); } - pluckingThisFrame = true; // Prevents standard pluck from playing in LateUpdate(). + // pluckingThisFrame = true; // Prevents standard pluck from playing in LateUpdate(). holdingHair = true; } @@ -138,7 +133,7 @@ namespace HeavenStudio.Games.Scripts_RhythmTweezers anim.Play("Tweezers_Pluck_Success", 0, 0); } - pluckingThisFrame = true; + // pluckingThisFrame = true; holdingHair = true; } diff --git a/Assets/Scripts/Games/TapTrial/TapTrial.cs b/Assets/Scripts/Games/TapTrial/TapTrial.cs index b243848cf..3102edf45 100644 --- a/Assets/Scripts/Games/TapTrial/TapTrial.cs +++ b/Assets/Scripts/Games/TapTrial/TapTrial.cs @@ -9,12 +9,13 @@ namespace HeavenStudio.Games.Loaders using static Minigames; public static class AgbTapLoader { - public static Minigame AddGame(EventCaller eventCaller) { + public static Minigame AddGame(EventCaller eventCaller) + { return new Minigame("tapTrial", "Tap Trial", "94ffb5", false, false, new List() { new GameAction("bop", "Bop") { - function = delegate { var e = eventCaller.currentEntity; TapTrial.instance.Bop(e.beat, e.length, e["toggle"], e["toggle2"]); }, + function = delegate { var e = eventCaller.currentEntity; TapTrial.instance.Bop(e.beat, e.length, e["toggle"], e["toggle2"]); }, resizable = true, parameters = new List() { @@ -24,26 +25,26 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("tap", "Tap") { - function = delegate { TapTrial.instance.Tap(eventCaller.currentEntity.beat); }, + function = delegate { TapTrial.instance.Tap(eventCaller.currentEntity.beat); }, defaultLength = 2.0f }, new GameAction("double tap", "Double Tap") { - function = delegate { TapTrial.instance.DoubleTap(eventCaller.currentEntity.beat); }, + function = delegate { TapTrial.instance.DoubleTap(eventCaller.currentEntity.beat); }, defaultLength = 2.0f }, new GameAction("triple tap", "Triple Tap") { - function = delegate { TapTrial.instance.TripleTap(eventCaller.currentEntity.beat); }, + function = delegate { TapTrial.instance.TripleTap(eventCaller.currentEntity.beat); }, defaultLength = 4.0f }, new GameAction("jump tap prep", "Prepare Stance") { - function = delegate { TapTrial.instance.JumpPrepare(); }, + function = delegate { TapTrial.instance.JumpPrepare(); }, }, new GameAction("jump tap", "Jump Tap") { - function = delegate { var e = eventCaller.currentEntity; TapTrial.instance.JumpTap(e.beat, e["final"]); }, + function = delegate { var e = eventCaller.currentEntity; TapTrial.instance.JumpTap(e.beat, e["final"]); }, defaultLength = 2.0f, parameters = new List() { @@ -52,7 +53,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("scroll event", "Scroll Background") { - function = delegate { var e = eventCaller.currentEntity; TapTrial.instance.Scroll(e["toggle"], e["flash"], e["m"]); }, + function = delegate { var e = eventCaller.currentEntity; TapTrial.instance.Scroll(e["toggle"], e["flash"], e["m"]); }, defaultLength = 1f, parameters = new List() { @@ -66,7 +67,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("giraffe events", "Giraffe Animations") { - function = delegate { var e = eventCaller.currentEntity; TapTrial.instance.GiraffeAnims(e.beat, e.length, e["toggle"], e["instant"]); }, + function = delegate { var e = eventCaller.currentEntity; TapTrial.instance.GiraffeAnims(e.beat, e.length, e["toggle"], e["instant"]); }, resizable = true, parameters = new List() { @@ -82,9 +83,9 @@ namespace HeavenStudio.Games.Loaders hidden = true }, }, - new List() {"agb", "normal"}, + new List() { "agb", "normal" }, "agbtap", "en", - new List() {} + new List() { } ); } } @@ -151,7 +152,7 @@ namespace HeavenStudio.Games currentNormalizedY = 0; flash.color = new Color(1, 1, 1, 0); } - + private bool scrolling; private bool flashing; [SerializeField] private float maxScrollSpeed = 0.25f; @@ -255,7 +256,7 @@ namespace HeavenStudio.Games if (bop) { List actions = new(); - for (int i = 0; i < length; i++) + for (int i = 0; i < length; i++) { actions.Add(new BeatAction.Action(beat + i, delegate { SingleBop(); })); } @@ -302,7 +303,7 @@ namespace HeavenStudio.Games new MultiSound.Sound("tapTrial/tapMonkey", beat + 1, 1.4f, 0.5f), }); - ScheduleInput(beat, 1, InputType.STANDARD_DOWN, JustTap, Miss, Empty); + ScheduleInput(beat, 1, InputAction_BasicPress, JustTap, Miss, Empty); } public void DoubleTap(double beat) @@ -340,8 +341,8 @@ namespace HeavenStudio.Games new MultiSound.Sound("tapTrial/tapMonkey", beat + 1.5, 1.4f, 0.5f), }); - ScheduleInput(beat, 1, InputType.STANDARD_DOWN, JustDoubleTap, Miss, Empty); - ScheduleInput(beat, 1.5, InputType.STANDARD_DOWN, JustDoubleTap, Miss, Empty); + ScheduleInput(beat, 1, InputAction_BasicPress, JustDoubleTap, Miss, Empty); + ScheduleInput(beat, 1.5, InputAction_BasicPress, JustDoubleTap, Miss, Empty); } public void TripleTap(double beat) @@ -384,9 +385,9 @@ namespace HeavenStudio.Games new MultiSound.Sound("tapTrial/tapMonkey", beat + 3, 1.4f, 0.5f), }); - ScheduleInput(beat, 2, InputType.STANDARD_DOWN, JustTripleTap, Miss, Empty); - ScheduleInput(beat, 2.5, InputType.STANDARD_DOWN, JustTripleTap, Miss, Empty); - ScheduleInput(beat, 3, InputType.STANDARD_DOWN, JustTripleTap, Miss, Empty); + ScheduleInput(beat, 2, InputAction_BasicPress, JustTripleTap, Miss, Empty); + ScheduleInput(beat, 2.5, InputAction_BasicPress, JustTripleTap, Miss, Empty); + ScheduleInput(beat, 3, InputAction_BasicPress, JustTripleTap, Miss, Empty); } public void JumpPrepare() @@ -425,7 +426,7 @@ namespace HeavenStudio.Games new MultiSound.Sound("tapTrial/tapMonkey", beat + 1, 1.4f, 0.5f), }); - ScheduleInput(beat, 1, InputType.STANDARD_DOWN, final ? JustJumpTapFinal : JustJumpTap, final ? MissJumpFinal : MissJump, Empty); + ScheduleInput(beat, 1, InputAction_BasicPress, final ? JustJumpTapFinal : JustJumpTap, final ? MissJumpFinal : MissJump, Empty); } private void JustJumpTap(PlayerActionEvent caller, float state) diff --git a/Assets/Scripts/Games/TapTrial/TapTrialPlayer.cs b/Assets/Scripts/Games/TapTrial/TapTrialPlayer.cs index 04a08c18e..d723218f0 100644 --- a/Assets/Scripts/Games/TapTrial/TapTrialPlayer.cs +++ b/Assets/Scripts/Games/TapTrial/TapTrialPlayer.cs @@ -31,7 +31,7 @@ namespace HeavenStudio.Games.Scripts_TapTrial private void Update() { - if (PlayerInput.Pressed() && !game.IsExpectingInputNow(InputType.STANDARD_DOWN)) + if (PlayerInput.GetIsAction(TapTrial.InputAction_BasicPress) && !game.IsExpectingInputNow(TapTrial.InputAction_BasicPress)) { WhiffTap(); } diff --git a/Assets/Scripts/Games/TapTroupe/TapTroupe.cs b/Assets/Scripts/Games/TapTroupe/TapTroupe.cs index 68f26c829..5f1b682b1 100644 --- a/Assets/Scripts/Games/TapTroupe/TapTroupe.cs +++ b/Assets/Scripts/Games/TapTroupe/TapTroupe.cs @@ -233,7 +233,7 @@ namespace HeavenStudio.Games } queuedTaps.Clear(); } - if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN)) + if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress)) { if (canSpit && !useTutorialMissFace) SoundByte.PlayOneShotGame("tapTroupe/spit", -1, 1, 0.5f); SoundByte.PlayOneShotGame("tapTroupe/miss"); @@ -351,7 +351,7 @@ namespace HeavenStudio.Games { for (int i = 0; i < length; i++) { - TapTroupe.instance.ScheduleInput(beat - 1, 1 + i, InputType.STANDARD_DOWN, TapTroupe.instance.JustStep, TapTroupe.instance.MissStep, TapTroupe.instance.Nothing); + TapTroupe.instance.ScheduleInput(beat - 1, 1 + i, InputAction_BasicPress, TapTroupe.instance.JustStep, TapTroupe.instance.MissStep, TapTroupe.instance.Nothing); BeatAction.New(instance, new List() { new BeatAction.Action(beat + i, delegate @@ -503,7 +503,7 @@ namespace HeavenStudio.Games soundsToPlay.Add(new MultiSound.Sound($"tapTroupe/{otherSoundToPlay}", beatToSpawn)); shouldDoSecondBam = secondBam; secondBam = !secondBam; - ScheduleInput(beatToSpawn - 1, 1f, InputType.STANDARD_DOWN, JustTap, MissTap, Nothing); + ScheduleInput(beatToSpawn - 1, 1f, InputAction_BasicPress, JustTap, MissTap, Nothing); } int actualOkayType = okayType; if (actualOkayType == (int)OkayType.Random) actualOkayType = UnityEngine.Random.Range(0, 3); diff --git a/Assets/Scripts/Games/TramAndPauline/TramAndPauline.cs b/Assets/Scripts/Games/TramAndPauline/TramAndPauline.cs index be3df2a12..c94bfc54d 100644 --- a/Assets/Scripts/Games/TramAndPauline/TramAndPauline.cs +++ b/Assets/Scripts/Games/TramAndPauline/TramAndPauline.cs @@ -1,4 +1,5 @@ using HeavenStudio.Util; +using HeavenStudio.InputSystem; using System; using System.Collections.Generic; using UnityEngine; @@ -97,6 +98,61 @@ namespace HeavenStudio.Games private bool goingUp = true; private Util.EasingFunction.Ease curtainEase = Util.EasingFunction.Ease.Linear; + const int IALeft = 0; + const int IARight = 1; + protected static bool IA_PadLeft(out double dt) + { + return PlayerInput.GetPadDown(InputController.ActionsPad.Up, out dt) + || PlayerInput.GetPadDown(InputController.ActionsPad.Down, out dt) + || PlayerInput.GetPadDown(InputController.ActionsPad.Left, out dt) + || PlayerInput.GetPadDown(InputController.ActionsPad.Right, out dt); + } + protected static bool IA_BatonLeft(out double dt) + { + return PlayerInput.GetBatonDown(InputController.ActionsBaton.West, out dt); + } + protected static bool IA_TouchLeft(out double dt) + { + bool want = PlayerInput.GetTouchDown(InputController.ActionsTouch.Left, out dt); + bool simul = false; + if (!want) + { + simul = PlayerInput.GetTouchDown(InputController.ActionsTouch.Right, out dt) + && instance.IsExpectingInputNow(InputAction_Left) + && instance.IsExpectingInputNow(InputAction_Right); + } + return want || simul; + } + + protected static bool IA_PadRight(out double dt) + { + return PlayerInput.GetPadDown(InputController.ActionsPad.East, out dt); + } + protected static bool IA_BatonRight(out double dt) + { + return PlayerInput.GetBatonDown(InputController.ActionsBaton.East, out dt); + } + protected static bool IA_TouchRight(out double dt) + { + bool want = PlayerInput.GetTouchDown(InputController.ActionsTouch.Right, out dt); + bool simul = false; + if (!want) + { + simul = PlayerInput.GetTouchDown(InputController.ActionsTouch.Left, out dt) + && instance.IsExpectingInputNow(InputAction_Left) + && instance.IsExpectingInputNow(InputAction_Right); + } + return want || simul; + } + + public static PlayerInput.InputAction InputAction_Left = + new("AgbTramLeft", new int[] { IALeft, IALeft, IALeft }, + IA_PadLeft, IA_TouchLeft, IA_BatonLeft); + + public static PlayerInput.InputAction InputAction_Right = + new("AgbTramRight", new int[] { IARight, IARight, IARight }, + IA_PadRight, IA_TouchRight, IA_BatonRight); + private void Awake() { instance = this; @@ -226,14 +282,14 @@ namespace HeavenStudio.Games { SoundByte.PlayOneShotGame("tramAndPauline/jump" + UnityEngine.Random.Range(1, 3)); tram.Jump(beat); - ScheduleInput(beat, 1, InputType.DIRECTION_DOWN, audienceReact ? TramJustAudience : TramJust, Empty, Empty); + ScheduleInput(beat, 1, InputAction_Left, audienceReact ? TramJustAudience : TramJust, Empty, Empty); } private void PaulineJump(double beat, bool audienceReact) { SoundByte.PlayOneShotGame("tramAndPauline/jump" + UnityEngine.Random.Range(1, 3)); pauline.Jump(beat); - ScheduleInput(beat, 1, InputType.STANDARD_DOWN, audienceReact ? PaulineJustAudience : PaulineJust, Empty, Empty); + ScheduleInput(beat, 1, InputAction_Right, audienceReact ? PaulineJustAudience : PaulineJust, Empty, Empty); } private void TramJust(PlayerActionEvent caller, float state) diff --git a/Assets/Scripts/Games/Tunnel/Tunnel.cs b/Assets/Scripts/Games/Tunnel/Tunnel.cs index 92f82d96f..30c1359ca 100644 --- a/Assets/Scripts/Games/Tunnel/Tunnel.cs +++ b/Assets/Scripts/Games/Tunnel/Tunnel.cs @@ -110,7 +110,7 @@ namespace HeavenStudio.Games { return; } - if (PlayerInput.Pressed() && !IsExpectingInputNow()) + if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress)) { HitCowbell(); //print("unexpected input"); @@ -154,7 +154,7 @@ namespace HeavenStudio.Games started = true; for(int i = 0; i < length; i++) { - ScheduleInput(beat, i, InputType.STANDARD_DOWN, CowbellSuccess, CowbellMiss, CowbellEmpty); + ScheduleInput(beat, i, InputAction_BasicPress, CowbellSuccess, CowbellMiss, CowbellEmpty); } } diff --git a/Assets/Scripts/Games/WizardsWaltz/Plant.cs b/Assets/Scripts/Games/WizardsWaltz/Plant.cs index 590c7f00f..f87d4bac7 100644 --- a/Assets/Scripts/Games/WizardsWaltz/Plant.cs +++ b/Assets/Scripts/Games/WizardsWaltz/Plant.cs @@ -25,7 +25,7 @@ namespace HeavenStudio.Games.Scripts_WizardsWaltz public void StartInput(double beat, float length) { - game.ScheduleInput(beat, length, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, Just, Miss, Out); + game.ScheduleInput(beat, length, WizardsWaltz.InputAction_Press, Just, Miss, Out); } private void Update() diff --git a/Assets/Scripts/Games/WizardsWaltz/Wizard.cs b/Assets/Scripts/Games/WizardsWaltz/Wizard.cs index 2e6273575..c64407e8b 100644 --- a/Assets/Scripts/Games/WizardsWaltz/Wizard.cs +++ b/Assets/Scripts/Games/WizardsWaltz/Wizard.cs @@ -40,7 +40,7 @@ namespace HeavenStudio.Games.Scripts_WizardsWaltz private void LateUpdate() { - if (PlayerInput.Pressed() || PlayerInput.GetAnyDirectionDown()) + if (PlayerInput.GetIsAction(WizardsWaltz.InputAction_Press)) { animator.Play("Magic", 0, 0); SoundByte.PlayOneShotGame("wizardsWaltz/wand"); diff --git a/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs b/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs index bfdfb97c7..25c5d4309 100644 --- a/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs +++ b/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs @@ -6,6 +6,7 @@ using System; using Starpelly; using HeavenStudio.Util; +using HeavenStudio.InputSystem; namespace HeavenStudio.Games.Loaders { @@ -71,6 +72,18 @@ namespace HeavenStudio.Games private static CallAndResponseHandler crHandlerInstance; + protected static bool IA_PadAnyDown(out double dt) + { + return PlayerInput.GetPadDown(InputController.ActionsPad.East, out dt) + || PlayerInput.GetPadDown(InputController.ActionsPad.Up, out dt) + || PlayerInput.GetPadDown(InputController.ActionsPad.Down, out dt) + || PlayerInput.GetPadDown(InputController.ActionsPad.Left, out dt) + || PlayerInput.GetPadDown(InputController.ActionsPad.Right, out dt); + } + public static PlayerInput.InputAction InputAction_Press = + new("AgbWizardPress", new int[] { IAPressCat, IAPressCat, IAPressCat }, + IA_PadAnyDown, IA_TouchBasicPress, IA_BatonBasicPress); + private void Awake() { instance = this;