public bool GetState(InputDevice inputDevice) { switch (SourceType) { case InputControlSourceType.Button: return(inputDevice.ReadRawButtonState(Index)); case InputControlSourceType.Analog: return(Utility.IsNotZero(GetValue(inputDevice))); case InputControlSourceType.KeyCode: return(Input.GetKey((KeyCode)Index)); default: throw new ArgumentOutOfRangeException(); } }