Skip to content

Instantly share code, notes, and snippets.

@korinVR
Last active December 16, 2021 01:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save korinVR/755aeae39f6ce973a438ec24d41908f4 to your computer and use it in GitHub Desktop.
Save korinVR/755aeae39f6ce973a438ec24d41908f4 to your computer and use it in GitHub Desktop.
Konami Code detector for Oculus Quest
public class KonamiCommand
{
readonly OVRInput.RawButton[] sequenceButtons =
{
OVRInput.RawButton.LThumbstickUp,
OVRInput.RawButton.LThumbstickUp,
OVRInput.RawButton.LThumbstickDown,
OVRInput.RawButton.LThumbstickDown,
OVRInput.RawButton.LThumbstickLeft,
OVRInput.RawButton.LThumbstickRight,
OVRInput.RawButton.LThumbstickLeft,
OVRInput.RawButton.LThumbstickRight,
OVRInput.RawButton.B,
OVRInput.RawButton.A,
};
int position;
public bool HasCompleted()
{
if (OVRInput.GetDown(OVRInput.RawButton.Any))
{
if (OVRInput.GetDown(sequenceButtons[position]))
{
if (++position >= sequenceButtons.Length)
{
position = 0;
return true;
}
}
else
{
position = 0;
}
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment