Пример #1
0
        public float GetAxis(string axisName)
        {
            InputAxis axis = _axisBindings.Where(a => a.Name == axisName).OrderByDescending(a => a.Timestamp).FirstOrDefault();

            if (axis != null)
            {
                return(axis.Value);
            }

            return(0);
        }
Пример #2
0
        public void AddAxisBinding(string axisName, string positiveKey, string negativeKey, float sensitivity = 1, float gravity = 1)
        {
            // Convert key names into key objects
            Key pKey = new Key(positiveKey);
            Key nKey = new Key(negativeKey);

            // Create axis and add it to the list
            var axis = new InputAxis(axisName, pKey, nKey, sensitivity, gravity);

            _axisBindings.Add(axis);

            // Add keys to be tracked
            _trackedKeys.AddRange(new[] { pKey, nKey });
        }