Fixed touch controls

FIxed touch controls being a miss no matter what
This commit is contained in:
wookywok 2024-03-05 13:43:36 -06:00
parent c809a2d976
commit 02131c2795
8 changed files with 1051 additions and 45 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -5,6 +5,8 @@ using NaughtyBezierCurves;
using DG.Tweening; using DG.Tweening;
using HeavenStudio.Util; using HeavenStudio.Util;
using HeavenStudio.InputSystem;
namespace HeavenStudio.Games.Scripts_NailCarpenter namespace HeavenStudio.Games.Scripts_NailCarpenter
{ {
@ -19,9 +21,12 @@ namespace HeavenStudio.Games.Scripts_NailCarpenter
{ {
game = NailCarpenter.instance; game = NailCarpenter.instance;
game.ScheduleInput(targetBeat, 1f, NailCarpenter.InputAction_AltPress, HammmerJust, HammmerMiss, Empty); game.ScheduleInput(targetBeat, 1f, NailCarpenter.InputAction_AltStart, HammmerJust, HammmerMiss, Empty);
// wrongInput // wrongInput
game.ScheduleUserInput(targetBeat, 1f, NailCarpenter.InputAction_BasicPress, weakHammmerJust, Empty, Empty); if (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch)
{
game.ScheduleUserInput(targetBeat, 1f, NailCarpenter.InputAction_RegPress, weakHammmerJust, Empty, Empty);
}
} }
private void HammmerJust(PlayerActionEvent caller, float state) private void HammmerJust(PlayerActionEvent caller, float state)

View file

@ -5,6 +5,8 @@ using NaughtyBezierCurves;
using DG.Tweening; using DG.Tweening;
using HeavenStudio.Util; using HeavenStudio.Util;
using HeavenStudio.InputSystem;
namespace HeavenStudio.Games.Scripts_NailCarpenter namespace HeavenStudio.Games.Scripts_NailCarpenter
{ {
@ -19,8 +21,12 @@ namespace HeavenStudio.Games.Scripts_NailCarpenter
{ {
game = NailCarpenter.instance; game = NailCarpenter.instance;
game.ScheduleInput(targetBeat, 0, NailCarpenter.InputAction_BasicPress, HammmerJust, HammmerMiss, Empty); game.ScheduleInput(targetBeat, 0, NailCarpenter.InputAction_RegPress, HammmerJust, HammmerMiss, Empty);
game.ScheduleUserInput(targetBeat, 0, NailCarpenter.InputAction_AltPress, strongHammmerJust, Empty, Empty); //wrong input
if (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch)
{
game.ScheduleUserInput(targetBeat, 0, NailCarpenter.InputAction_AltStart, strongHammmerJust, Empty, Empty);
}
} }
private void HammmerJust(PlayerActionEvent caller, float state) private void HammmerJust(PlayerActionEvent caller, float state)

View file

@ -99,10 +99,18 @@ namespace HeavenStudio.Games
{ {
return PlayerInput.GetSqueezeDown(out dt); return PlayerInput.GetSqueezeDown(out dt);
} }
protected static bool IA_TouchRegularPress(out double dt)
{
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
&& instance.IsExpectingInputNow(InputAction_RegPress)
&& !instance.IsExpectingInputNow(InputAction_AltStart);
}
protected static bool IA_TouchAltPress(out double dt) protected static bool IA_TouchAltPress(out double dt)
{ {
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt) return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
&& instance.IsExpectingInputNow(InputAction_AltPress); && instance.IsExpectingInputNow(InputAction_AltStart)
&& !instance.IsExpectingInputNow(InputAction_RegPress);
} }
protected static bool IA_PadAltRelease(out double dt) protected static bool IA_PadAltRelease(out double dt)
@ -114,7 +122,11 @@ namespace HeavenStudio.Games
return PlayerInput.GetSqueezeUp(out dt); return PlayerInput.GetSqueezeUp(out dt);
} }
public static PlayerInput.InputAction InputAction_AltPress =
public static PlayerInput.InputAction InputAction_RegPress =
new("PcoNailRegStart", new int[] { IAPressCat, IAPressCat, IAPressCat },
IA_PadBasicPress, IA_TouchRegularPress, IA_BatonBasicPress);
public static PlayerInput.InputAction InputAction_AltStart =
new("PcoNailAltStart", new int[] { IAAltDownCat, IAAltDownCat, IAAltDownCat }, new("PcoNailAltStart", new int[] { IAAltDownCat, IAAltDownCat, IAAltDownCat },
IA_PadAltPress, IA_TouchAltPress, IA_BatonAltPress); IA_PadAltPress, IA_TouchAltPress, IA_BatonAltPress);
public static PlayerInput.InputAction InputAction_AltFinish = public static PlayerInput.InputAction InputAction_AltFinish =
@ -147,14 +159,14 @@ namespace HeavenStudio.Games
// Debug.Log(newBeat); // Debug.Log(newBeat);
if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress)) if (PlayerInput.GetIsAction(InputAction_RegPress) && !IsExpectingInputNow(InputAction_RegPress))
{ {
SoundByte.PlayOneShot("miss"); SoundByte.PlayOneShot("miss");
Carpenter.DoScaledAnimationAsync("carpenterHit", 0.25f); Carpenter.DoScaledAnimationAsync("carpenterHit", 0.25f);
hasSlurped = false; hasSlurped = false;
// ScoreMiss(); // ScoreMiss();
} }
if (PlayerInput.GetIsAction(InputAction_AltPress) && !IsExpectingInputNow(InputAction_AltPress)) if (PlayerInput.GetIsAction(InputAction_AltStart) && !IsExpectingInputNow(InputAction_AltStart))
{ {
SoundByte.PlayOneShot("miss"); SoundByte.PlayOneShot("miss");
Carpenter.DoScaledAnimationAsync("carpenterHit", 0.25f); Carpenter.DoScaledAnimationAsync("carpenterHit", 0.25f);

View file

@ -31,7 +31,7 @@ namespace HeavenStudio.Games.Scripts_NailCarpenter
game = NailCarpenter.instance; game = NailCarpenter.instance;
AwakeAnim(); AwakeAnim();
game.ScheduleUserInput(targetBeat, 0, NailCarpenter.InputAction_BasicPress, HammmerJust, Empty, Empty); game.ScheduleUserInput(targetBeat, 0, NailCarpenter.InputAction_RegPress, HammmerJust, Empty, Empty);
game.ScheduleUserInput(targetBeat, 0, NailCarpenter.InputAction_AltFinish, HammmerJust, Empty, Empty); game.ScheduleUserInput(targetBeat, 0, NailCarpenter.InputAction_AltFinish, HammmerJust, Empty, Empty);
} }
private void AwakeAnim() private void AwakeAnim()