void AddKeyInAction(TCT_ActionInput _action, KeyCode _key) { if (_action.AllKeyCodes.Any(n => n == KeyCode.None)) { Debug.LogWarning("A key is not assign. Please assign it to get an other key"); return; } _action.AddKey(_key); }
public void SubAtActionInput(string _nameActionInput, Action <bool> _methodeToSub) { if (!ExistActionInput(_nameActionInput)) { Debug.LogError($"No one ActionInput is named by {_nameActionInput}"); return; } TCT_ActionInput _currentAction = GetActionInput(_nameActionInput); _currentAction.ActionInput += _methodeToSub; }
void DrawKeysActionInput(bool _show, TCT_ActionInput _action) { if (!_show) { return; } if (_action == null || _action.AllKeyCodes.Count < 1) { return; } for (int i = 0; i < _action.AllKeyCodes.Count; i++) { Enum _currentKeyCode = _action.AllKeyCodes[i]; EditorGUILayout.BeginHorizontal(); EditorGUILayout.Separator(); EditorLayout.EnumPopup(ref _currentKeyCode, ""); if (_action.ExistKeyCode((KeyCode)_currentKeyCode) && (KeyCode)_currentKeyCode != _action.AllKeyCodes[i]) { Debug.LogWarning("this Key is already assign in this Action. Please select an other"); } else { _action.AllKeyCodes[i] = (KeyCode)_currentKeyCode; } EditorLayout.Button("x", RemoveKeyCode, _action, (KeyCode)_currentKeyCode); EditorGUILayout.EndHorizontal(); EditorLayout.Space(); } }
void RemoveKeyCode(TCT_ActionInput _action, KeyCode _key) { _action.RemoveKey(_key); }
public void RemoveActionInput(TCT_ActionInput _action) { allActionInput.Remove(_action); }
public void AddActionInput(TCT_ActionInput _action) => allActionInput.Add(_action);