Last active
December 16, 2021 01:08
-
-
Save korinVR/755aeae39f6ce973a438ec24d41908f4 to your computer and use it in GitHub Desktop.
Konami Code detector for Oculus Quest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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