public static void AssignKeyToKeyInfo(GameKeyInfo _keyInfo, KeyCode _key, bool _isPrimary) { GameKeyInfo keyInfo = _keyInfo; KeyCode key = _key; bool isPrimary = _isPrimary; if (key == KeyCode.None) { if (isPrimary) { keyInfo.primary = KeyCode.None; keyInfo.prInputName = ""; } else { keyInfo.secondary = KeyCode.None; keyInfo.secInputName = ""; } return; } bool isKeyUsedBefore = false; for (int i = 0; i < keys._allKeys.Count; i++) { if (keys._allKeys[i].primary == key) { keys._allKeys[i].primary = KeyCode.None; keys._allKeys[i].prInputName = ""; isKeyUsedBefore = true; } if (keys._allKeys[i].secondary == key) { keys._allKeys[i].secondary = KeyCode.None; keys._allKeys[i].secInputName = ""; isKeyUsedBefore = true; } } if (isPrimary) { keyInfo.primary = key; keyInfo.prInputName = GetKeyButtonNameByItsKeyCode(key); } else { keyInfo.secondary = key; keyInfo.secInputName = GetKeyButtonNameByItsKeyCode(key); } }
static bool GetKeyInfo_Button_IfGameIsNotPaused(GameKeyInfo _keyInfo) { GameKeyInfo keyInfo = _keyInfo; if (!string.IsNullOrEmpty(keyInfo.prInputName)) { if (GetButton_IfGameIsNotPaused(keyInfo.prInputName)) { return(true); } } if (!string.IsNullOrEmpty(keyInfo.secInputName)) { if (GetButton_IfGameIsNotPaused(keyInfo.secInputName)) { return(true); } } return(false); }
static bool GetKeyInfo_IfGameIsNotPaused(GameKeyInfo _keyInfo) { GameKeyInfo keyInfo = _keyInfo; return(GetKey_IfGameIsNotPaused(keyInfo.primary) || GetKey_IfGameIsNotPaused(keyInfo.secondary)); }