private void Update() { if (fb.GetKeyDown(keyID)) { Toggle(); } }
/* * public void SaveFBSettings() { * setKeys(PlayerPrefsManager.GetFitboardKeyAssignments()); * } * * * public void setKeys(string keys) { * if (keys == null || keys == "") * return; * string[] keyGroups = keys.Split('.'); * if (keyGroups.Length >= 1) { * key1 = keyGroups[1].Split('-'); * } * * if (keyGroups.Length >= 2) { * key2 = keyGroups[1].Split('-'); * } * * if (keyGroups.Length >= 3) { * key3 = keyGroups[1].Split('-'); * } * * if (keyGroups.Length >= 4) { * key4 = keyGroups[1].Split('-'); * } * * if (keyGroups.Length > 5) { * Debug.LogWarning("More than 4 key types found by FITBoardSetter"); * } * * } */ public bool GetKeysDown(List <string> keys) { bool ans = false; foreach (string key in keys) { if (fb.GetKeyDown(key)) { ans = true; break; } } return(ans); }
/// <summary> /// Handles key input for this key. /// </summary> protected void HandleKey() { if (active) { if (fb.GetKeyPressed(keyID)) { KeyPressed(); } if (fb.GetKeyDown(keyID)) { KeyDown(); } else if (fb.GetKeyUp(keyID)) { KeyUp(); } } }
/// <summary> /// Checks if any of the keys in the given list become pressed this frame. /// </summary> /// <param name="keys"> The list of keys to check. </param> /// <returns> Returns true if any of the keys become pressed. </returns> public bool GetKeysDown(List <string> keys) { if (!ReGameVR.Games.Pause.isPaused) { bool ans = false; foreach (string key in keys) { if (fb.GetKeyDown(key)) { ans = true; break; } } return(ans); } else { return(false); } }