Exemple #1
0
        public InputDefines.ButtonCondition GetKeyButton(KeyCode keyCode)
        {
            if (!EnabledKeyCodes.Contains(keyCode))
            {
                return(InputDefines.ButtonCondition.Free);
            }

            keyCode = TransformKeyCode(keyCode);
            return(_keyButtonsDict.ContainsKey(keyCode)
                ? _keyButtonsDict[keyCode].Value
                : InputDefines.ButtonCondition.Free);
        }
Exemple #2
0
        public void SetKeyButton(KeyCode keyCode, InputDefines.ButtonCondition condition)
        {
            if (!EnabledKeyCodes.Contains(keyCode))
            {
                return;
            }

            if (!_keyButtonsDict.ContainsKey(keyCode))
            {
                // InputDefines.ButtonCondition.Free must be InputDefines.ButtonCondition.Free for IUpdateObserver.DidUpdated!
                var initialCondition = InputDefines.ButtonCondition.Free;
                _keyButtonsDict.Add(keyCode, new UpdateObserver <InputDefines.ButtonCondition>(initialCondition));
            }
            _keyButtonsDict[keyCode].Value = condition;
        }