mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 11:45:09 +00:00
Fixed Input bugs + Optimizations
-- On the PlayerInput class -- FIXED: Bug where Directions input were still recorded even with autoplay on OPTIMIZED: Moved the conditions wether player had control in it's own method so we can re-use the same condition on new methods
This commit is contained in:
parent
d41eaac105
commit
70a69a7c91
2 changed files with 19 additions and 10 deletions
|
@ -74,7 +74,7 @@ namespace HeavenStudio.Games
|
||||||
|
|
||||||
this.audienceReacting = audienceReacting;
|
this.audienceReacting = audienceReacting;
|
||||||
|
|
||||||
coin = ScheduleInput(beat, 6f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty);
|
coin = ScheduleInput(beat, 6f, InputType.DIRECTION_DOWN, CatchSuccess, CatchMiss, CatchEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CatchSuccess(int state)
|
public void CatchSuccess(int state)
|
||||||
|
|
|
@ -28,44 +28,53 @@ namespace HeavenStudio
|
||||||
|
|
||||||
public static bool AltPressed()
|
public static bool AltPressed()
|
||||||
{
|
{
|
||||||
return Input.GetKeyDown(KeyCode.X) && !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
|
return Input.GetKeyDown(KeyCode.X) && playerHasControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool AltPressedUp()
|
public static bool AltPressedUp()
|
||||||
{
|
{
|
||||||
return Input.GetKeyUp(KeyCode.X) && !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
|
return Input.GetKeyUp(KeyCode.X) && playerHasControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool AltPressing()
|
public static bool AltPressing()
|
||||||
{
|
{
|
||||||
return Input.GetKey(KeyCode.X) && !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
|
return Input.GetKey(KeyCode.X) && playerHasControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool GetAnyDirectionDown()
|
public static bool GetAnyDirectionDown()
|
||||||
{
|
{
|
||||||
return Input.GetKeyDown(KeyCode.UpArrow)
|
return (Input.GetKeyDown(KeyCode.UpArrow)
|
||||||
|| Input.GetKeyDown(KeyCode.DownArrow)
|
|| Input.GetKeyDown(KeyCode.DownArrow)
|
||||||
|| Input.GetKeyDown(KeyCode.LeftArrow)
|
|| Input.GetKeyDown(KeyCode.LeftArrow)
|
||||||
|| Input.GetKeyDown(KeyCode.RightArrow);
|
|| Input.GetKeyDown(KeyCode.RightArrow)) && playerHasControl();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool GetAnyDirectionUp()
|
public static bool GetAnyDirectionUp()
|
||||||
{
|
{
|
||||||
return Input.GetKeyUp(KeyCode.UpArrow)
|
return (Input.GetKeyUp(KeyCode.UpArrow)
|
||||||
|| Input.GetKeyUp(KeyCode.DownArrow)
|
|| Input.GetKeyUp(KeyCode.DownArrow)
|
||||||
|| Input.GetKeyUp(KeyCode.LeftArrow)
|
|| Input.GetKeyUp(KeyCode.LeftArrow)
|
||||||
|| Input.GetKeyUp(KeyCode.RightArrow);
|
|| Input.GetKeyUp(KeyCode.RightArrow)) && playerHasControl();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool GetAnyDirection()
|
public static bool GetAnyDirection()
|
||||||
{
|
{
|
||||||
return Input.GetKey(KeyCode.UpArrow)
|
return (Input.GetKey(KeyCode.UpArrow)
|
||||||
|| Input.GetKey(KeyCode.DownArrow)
|
|| Input.GetKey(KeyCode.DownArrow)
|
||||||
|| Input.GetKey(KeyCode.LeftArrow)
|
|| Input.GetKey(KeyCode.LeftArrow)
|
||||||
|| Input.GetKey(KeyCode.RightArrow);
|
|| Input.GetKey(KeyCode.RightArrow)) && playerHasControl();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// The autoplay isn't activated AND
|
||||||
|
// The song is actually playing AND
|
||||||
|
// The GameManager allows you to Input
|
||||||
|
public static bool playerHasControl()
|
||||||
|
{
|
||||||
|
return !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue