address input lockout

- removes redundant code from PlayerActionObject which would actually lock out timing windows
This commit is contained in:
minenice55 2022-08-14 00:34:19 -04:00
parent 99b2294561
commit 33e2da9f9e
3 changed files with 40 additions and 24 deletions

View file

@ -125,7 +125,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
Jukebox.PlayOneShotGame("karateman/swingNoHit", forcePlay: true); Jukebox.PlayOneShotGame("karateman/swingNoHit", forcePlay: true);
} }
} }
else if (PlayerInput.AltPressed() && KarateMan.instance.IsComboEnable && !inSpecial)
if (PlayerInput.AltPressed() && KarateMan.instance.IsComboEnable && !inSpecial)
{ {
if (!KarateMan.instance.IsExpectingInputNow()) if (!KarateMan.instance.IsExpectingInputNow())
{ {

View file

@ -166,13 +166,16 @@ namespace HeavenStudio.Games.Scripts_KarateMan
} }
} }
PlayerActionEvent OnHit;
PlayerActionEvent OnHitWrongAction;
void Awake() void Awake()
{ {
switch (type) switch (type)
{ {
case ItemType.ComboPot1: case ItemType.ComboPot1:
KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ComboStartJustOrNg, ComboStartThrough, ComboStartOut); OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ComboStartJustOrNg, ComboStartThrough, ComboStartOut);
KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ComboStartWrongAction, ComboStartOut, ComboStartOut); OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ComboStartWrongAction, ComboStartOut, ComboStartOut);
path = 1; path = 1;
break; break;
case ItemType.ComboPot2: case ItemType.ComboPot2:
@ -194,20 +197,20 @@ namespace HeavenStudio.Games.Scripts_KarateMan
break; break;
case ItemType.ComboBarrel: case ItemType.ComboBarrel:
//check for button release //check for button release
KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_ALT_UP, ComboEndJustOrNg, ComboEndThrough, ComboEndOut); OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_ALT_UP, ComboEndJustOrNg, ComboEndThrough, ComboEndOut);
//button presses //button presses
KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ComboEndWrongAction, ItemOut, ItemOut); KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ComboEndWrongAction, ItemOut, ItemOut);
KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ComboEndWrongActionAlt, ItemOut, ItemOut); KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ComboEndWrongActionAlt, ItemOut, ItemOut);
path = 5; path = 5;
break; break;
case ItemType.KickBarrel: case ItemType.KickBarrel:
KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, KickChargeJustOrNg, ItemThrough, ItemOut); OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, KickChargeJustOrNg, ItemThrough, ItemOut);
KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ItemWrongAction, ItemOut, ItemOut); OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ItemWrongAction, ItemOut, ItemOut);
path = 1; path = 1;
comboId = -1; comboId = -1;
break; break;
case ItemType.KickBomb: case ItemType.KickBomb:
KarateMan.instance.ScheduleInput(startBeat, 0.75f, InputType.STANDARD_UP | InputType.DIRECTION_UP, KickJustOrNg, KickThrough, KickOut); OnHit = KarateMan.instance.ScheduleInput(startBeat, 0.75f, InputType.STANDARD_UP | InputType.DIRECTION_UP, KickJustOrNg, KickThrough, KickOut);
CurrentCurve = ItemCurves[6]; CurrentCurve = ItemCurves[6];
curveTargetBeat = 2 * 0.75f; curveTargetBeat = 2 * 0.75f;
path = 1; path = 1;
@ -221,8 +224,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
comboId = -1; comboId = -1;
break; break;
default: default:
KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ItemJustOrNg, ItemThrough, ItemOut); OnHit = KarateMan.instance.ScheduleInput(startBeat, 1f, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, ItemJustOrNg, ItemThrough, ItemOut);
KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ItemWrongAction, ItemOut, ItemOut); OnHitWrongAction = KarateMan.instance.ScheduleUserInput(startBeat, 1f, InputType.STANDARD_ALT_DOWN, ItemWrongAction, ItemOut, ItemOut);
path = 1; path = 1;
comboId = -1; comboId = -1;
break; break;
@ -574,7 +577,6 @@ namespace HeavenStudio.Games.Scripts_KarateMan
{ {
if (GameManager.instance.currentGame != "karateman") return; if (GameManager.instance.currentGame != "karateman") return;
var joe = KarateMan.instance.Joe; var joe = KarateMan.instance.Joe;
Debug.Log("ItemJustOrNg | accuracy: " + state);
if (status == FlyStatus.Fly && !(joe.inCombo || joe.inNuriLock)) { if (status == FlyStatus.Fly && !(joe.inCombo || joe.inNuriLock)) {
if (state <= -1f || state >= 1f) { if (state <= -1f || state >= 1f) {
bool straight = joe.Punch(ItemPunchHand()); bool straight = joe.Punch(ItemPunchHand());
@ -616,6 +618,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
KarateMan.instance.Nori.DoHit(); KarateMan.instance.Nori.DoHit();
} }
} }
OnHit.CanHit(false);
OnHitWrongAction.CanHit(false);
} }
public void ItemWrongAction(PlayerActionEvent caller, float state) public void ItemWrongAction(PlayerActionEvent caller, float state)
@ -649,6 +653,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}); });
KarateMan.instance.Nori.DoThrough(); KarateMan.instance.Nori.DoThrough();
} }
OnHit.CanHit(false);
OnHitWrongAction.CanHit(false);
} }
public void ItemOut(PlayerActionEvent caller) {} public void ItemOut(PlayerActionEvent caller) {}
@ -670,6 +676,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}), }),
}); });
KarateMan.instance.Nori.DoThrough(); KarateMan.instance.Nori.DoThrough();
OnHit.CanHit(false);
OnHitWrongAction.CanHit(false);
} }
public void ComboStartJustOrNg(PlayerActionEvent caller, float state) public void ComboStartJustOrNg(PlayerActionEvent caller, float state)
@ -695,6 +703,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
KarateMan.instance.Nori.DoHit(); KarateMan.instance.Nori.DoHit();
} }
} }
OnHit.CanHit(false);
OnHitWrongAction.CanHit(false);
} }
public void ComboStartOut(PlayerActionEvent caller) {} public void ComboStartOut(PlayerActionEvent caller) {}
@ -715,6 +725,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}), }),
}); });
KarateMan.instance.Nori.DoThrough(); KarateMan.instance.Nori.DoThrough();
OnHit.CanHit(false);
OnHitWrongAction.CanHit(false);
} }
public void ComboStartWrongAction(PlayerActionEvent caller, float state) public void ComboStartWrongAction(PlayerActionEvent caller, float state)
@ -737,6 +749,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
} }
KarateMan.instance.Nori.DoThrough(); KarateMan.instance.Nori.DoThrough();
} }
OnHit.CanHit(false);
OnHitWrongAction.CanHit(false);
} }
public void ComboEndJustOrNg(PlayerActionEvent caller, float state) public void ComboEndJustOrNg(PlayerActionEvent caller, float state)
@ -781,6 +795,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
KarateMan.instance.Nori.DoHit(); KarateMan.instance.Nori.DoHit();
} }
} }
OnHit.CanHit(false);
} }
public void ComboEndOut(PlayerActionEvent caller) { public void ComboEndOut(PlayerActionEvent caller) {
@ -794,6 +809,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
joe.ComboSequence(3); joe.ComboSequence(3);
Jukebox.PlayOneShotGame("karateman/swingKick", forcePlay: true); Jukebox.PlayOneShotGame("karateman/swingKick", forcePlay: true);
} }
OnHit.CanHit(false);
} }
public void ComboEndThrough(PlayerActionEvent caller) public void ComboEndThrough(PlayerActionEvent caller)
@ -834,6 +850,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}); });
} }
KarateMan.instance.Nori.DoThrough(); KarateMan.instance.Nori.DoThrough();
OnHit.CanHit(false);
} }
public void ComboEndWrongAction(PlayerActionEvent caller, float state) public void ComboEndWrongAction(PlayerActionEvent caller, float state)
@ -879,6 +896,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
KarateMan.instance.Nori.DoHit(); KarateMan.instance.Nori.DoHit();
} }
} }
OnHit.CanHit(false);
OnHitWrongAction.CanHit(false);
} }
public void KickChargeOut(PlayerActionEvent caller) {} public void KickChargeOut(PlayerActionEvent caller) {}
@ -900,6 +919,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}), }),
}); });
KarateMan.instance.Nori.DoThrough(); KarateMan.instance.Nori.DoThrough();
OnHit.CanHit(false);
OnHitWrongAction.CanHit(false);
} }
public void KickJustOrNg(PlayerActionEvent caller, float state) public void KickJustOrNg(PlayerActionEvent caller, float state)
@ -948,6 +969,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
KarateMan.instance.Nori.DoHit(); KarateMan.instance.Nori.DoHit();
} }
} }
OnHit.CanHit(false);
} }
public void KickOut(PlayerActionEvent caller) {} public void KickOut(PlayerActionEvent caller) {}
@ -965,6 +987,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
}) })
}); });
KarateMan.instance.Nori.DoThrough(); KarateMan.instance.Nori.DoThrough();
OnHit.CanHit(false);
} }
} }
} }

View file

@ -9,7 +9,6 @@ namespace HeavenStudio.Games
public class PlayerActionObject : MonoBehaviour public class PlayerActionObject : MonoBehaviour
{ {
public bool inList = false; public bool inList = false;
public int lastState;
public Minigame.Eligible state = new Minigame.Eligible(); public Minigame.Eligible state = new Minigame.Eligible();
public List<Minigame.Eligible> eligibleHitsList = new List<Minigame.Eligible>(); public List<Minigame.Eligible> eligibleHitsList = new List<Minigame.Eligible>();
@ -50,7 +49,6 @@ namespace HeavenStudio.Games
public void ResetState() public void ResetState()
{ {
lastState = 0;
ResetAce(); ResetAce();
} }
@ -58,22 +56,19 @@ namespace HeavenStudio.Games
public void StateCheck(float normalizedBeat, bool autoPlay = false) public void StateCheck(float normalizedBeat, bool autoPlay = false)
{ {
CheckForAce(normalizedBeat, autoPlay); CheckForAce(normalizedBeat, autoPlay);
if (normalizedBeat > Minigame.EarlyTime() && normalizedBeat < Minigame.PerfectTime() && lastState == 0) if (normalizedBeat > Minigame.EarlyTime() && normalizedBeat < Minigame.PerfectTime())
{ {
MakeEligible(true, false, false); MakeEligible(true, false, false);
lastState++;
} }
// Perfect State // Perfect State
else if (normalizedBeat > Minigame.PerfectTime() && normalizedBeat < Minigame.LateTime() && lastState == 1) else if (normalizedBeat > Minigame.PerfectTime() && normalizedBeat < Minigame.LateTime())
{ {
MakeEligible(false, true, false); MakeEligible(false, true, false);
lastState++;
} }
// Late State // Late State
else if (normalizedBeat > Minigame.LateTime() && normalizedBeat < Minigame.EndTime() && lastState == 2) else if (normalizedBeat > Minigame.LateTime() && normalizedBeat < Minigame.EndTime())
{ {
MakeEligible(false, false, true); MakeEligible(false, false, true);
lastState++;
} }
else if (normalizedBeat < Minigame.EarlyTime() || normalizedBeat > Minigame.EndTime()) else if (normalizedBeat < Minigame.EarlyTime() || normalizedBeat > Minigame.EndTime())
{ {
@ -126,22 +121,19 @@ namespace HeavenStudio.Games
public void StateCheckNoList(float normalizedBeat) public void StateCheckNoList(float normalizedBeat)
{ {
CheckForAce(normalizedBeat); CheckForAce(normalizedBeat);
if (normalizedBeat > Minigame.EarlyTime() && normalizedBeat < Minigame.PerfectTime() && lastState == 0) if (normalizedBeat > Minigame.EarlyTime() && normalizedBeat < Minigame.PerfectTime())
{ {
ModifyState(true, false, false); ModifyState(true, false, false);
lastState++;
} }
// Perfect State // Perfect State
else if (normalizedBeat > Minigame.PerfectTime() && normalizedBeat < Minigame.LateTime() && lastState == 1) else if (normalizedBeat > Minigame.PerfectTime() && normalizedBeat < Minigame.LateTime())
{ {
ModifyState(false, true, false); ModifyState(false, true, false);
lastState++;
} }
// Late State // Late State
else if (normalizedBeat > Minigame.LateTime() && normalizedBeat < Minigame.EndTime() && lastState == 2) else if (normalizedBeat > Minigame.LateTime() && normalizedBeat < Minigame.EndTime())
{ {
ModifyState(false, false, true); ModifyState(false, false, true);
lastState++;
} }
else if (normalizedBeat < Minigame.EarlyTime() || normalizedBeat > Minigame.EndTime()) else if (normalizedBeat < Minigame.EarlyTime() || normalizedBeat > Minigame.EndTime())
{ {