public InputControl AddControl( InputControlType target, string handle ) { var controlIndex = (int) target; var inputControl = new InputControl( handle, target ); Controls[controlIndex] = inputControl; return inputControl; }
public InputDevice( string name ) { Name = name; Meta = ""; LastChangeTick = 0; const int numInputControlTypes = (int) InputControlType.Count + 1; Controls = new InputControl[numInputControlTypes]; LeftStickX = new OneAxisInputControl(); LeftStickY = new OneAxisInputControl(); LeftStick = new TwoAxisInputControl(); LeftStick.LowerDeadZone = 0.2f; RightStickX = new OneAxisInputControl(); RightStickY = new OneAxisInputControl(); RightStick = new TwoAxisInputControl(); RightStick.LowerDeadZone = 0.2f; DPadX = new OneAxisInputControl(); DPadY = new OneAxisInputControl(); DPad = new TwoAxisInputControl(); DPad.LowerDeadZone = 0.2f; Command = AddControl( InputControlType.Command, "Command" ); }
internal void CommitWithSides( InputControl negativeSide, InputControl positiveSide, ulong updateTick, float deltaTime ) { LowerDeadZone = Mathf.Max( negativeSide.LowerDeadZone, positiveSide.LowerDeadZone ); UpperDeadZone = Mathf.Min( negativeSide.UpperDeadZone, positiveSide.UpperDeadZone ); Raw = negativeSide.Raw || positiveSide.Raw; var value = Utility.ValueFromSides( negativeSide.RawValue, positiveSide.RawValue ); CommitWithValue( value, updateTick, deltaTime ); }
internal void CommitWithSides( InputControl negativeSide, InputControl positiveSide, ulong updateTick, float deltaTime, bool invertSides ) { if (invertSides) { CommitWithSides( positiveSide, negativeSide, updateTick, deltaTime ); } else { CommitWithSides( negativeSide, positiveSide, updateTick, deltaTime ); } }
public InputDevice( string name, int analogCount = 0, int buttonCount = 0 ) { Name = name; Meta = ""; Analogs = new InputControl[ analogCount ]; Buttons = new InputControl[ buttonCount ]; LastChangeTime = 0.0f; const int numInputControlTypes = (int) InputControlType.Count + 1; controlTable = new InputControl[ numInputControlTypes ]; }
public static void CheckButtonEvents(IC.InputControlType type, IC.InputDevice device, GameObject player, Message?pressedEvent = null, Message?releasedEvent = null) { if (device != null) { IC.InputControl button = device.GetControl(type); SendButtonEvent(button.WasPressed, button.WasReleased, player, pressedEvent, releasedEvent); } }
public InputDevice( string name ) { Name = name; Meta = ""; LastChangeTick = 0; const int numInputControlTypes = (int) InputControlType.Count + 1; Controls = new InputControl[numInputControlTypes]; LeftStick = new TwoAxisInputControl(); RightStick = new TwoAxisInputControl(); DPad = new TwoAxisInputControl(); }
public InputDevice(string name) { Name = name; Meta = ""; LastChangeTick = 0; int numInputControlTypes = Enum.GetValues(typeof(InputControlTarget)).Length; Controls = new InputControl[numInputControlTypes]; LeftStick = new TwoAxisInputControl(); RightStick = new TwoAxisInputControl(); DPad = new TwoAxisInputControl(); }
public InputControl AddControl( InputControlType inputControlType, string handle ) { var inputControl = new InputControl( handle, inputControlType ); Controls[(int) inputControlType] = inputControl; return inputControl; }
public void SetButtonControl( int i, Enum target, string handle = "" ) { Buttons[i] = new InputControl( handle, target.ToString() ); var controlIndex = Convert.ToInt32( target ); controlTable[controlIndex] = Buttons[i]; }
public InputControl GetControl(InputControlType controlType) { InputControl inputControl = ControlsByTarget[(int)controlType]; return(inputControl ?? InputControl.Null); }
bool IsPressed( InputControl control ) { return Utility.AbsoluteIsOverThreshold( control.Value, 0.5f ); }
void Initialize( string name, int analogCount, int buttonCount ) { Name = name; Meta = ""; Analogs = new InputControl[analogCount]; Buttons = new InputControl[buttonCount]; LastChangeTime = 0.0f; const int numInputControlTypes = (int) InputControlType.Count + 1; controlTable = new InputControl[numInputControlTypes]; }
public void SetAnalogControl( int i, Enum target, string handle ) { Analogs[i] = new InputControl( handle, target.ToString() ); var controlIndex = Convert.ToInt32( target ); controlTable[controlIndex] = Analogs[i]; }
float ProcessAnalogControlValue( InputControl control, float deltaTime ) { var analogValue = control.PreValue.Value; var obverseTarget = control.Obverse; if (obverseTarget.HasValue) { var obverseControl = GetControl( obverseTarget ); analogValue = ApplyCircularDeadZone( analogValue, obverseControl.PreValue.Value, control.LowerDeadZone, control.UpperDeadZone ); } else { analogValue = ApplyDeadZone( analogValue, control.LowerDeadZone, control.UpperDeadZone ); } return ApplySmoothing( analogValue, control.LastValue, deltaTime, control.Sensitivity ); }
public InputControl AddControl(InputControlTarget inputControlTarget, string handle) { var inputControl = new InputControl(handle, inputControlTarget); Controls[(int) inputControlTarget] = inputControl; return inputControl; }
public InputControl AddControl( InputControlType target, string handle, int player = -1 ) { var inputControl = new InputControl( handle, target, player ); Controls.Add(inputControl); return inputControl; }