public AxisBinding(BindingSet bs, ConfigNode node) { int ind; if (int.TryParse(node.GetValue("index"), out ind)) { index = ind; } binding = AI_FlightControl.GetAxisBinding(node); bool b; if (bool.TryParse(node.GetValue("invert"), out b)) { invert = b; } float c; if (float.TryParse(node.GetValue("curve"), out c)) { curve = c; } bindingSet = bs; prevValue = bindingSet.AxisValue(index, invert); }
void OnDestroy() { instance = null; GameEvents.onVesselChange.Remove(OnVesselChange); GameEvents.onInputLocksModified.Remove(OnInputLocksModified); InputLib.Close(); InputLib.DeviceAdded -= DeviceAdded; InputLib.DeviceRemoved -= DeviceRemoved; FlightInputHandler.OnRawAxisInput -= ControlUpdate; }
public ButtonBinding(BindingSet bs, ConfigNode node) { int ind; if (int.TryParse(node.GetValue("index"), out ind)) { index = ind; } binding = AI_FlightControl.GetButtonBinding(node); bindingSet = bs; prevState = bindingSet.ButtonState(index); }
void Awake() { if (axisBindings == null) { DiscoverAxisBindings(); DiscoverButtonBindings(); } instance = this; onVesselChange = new EventData <Vessel>("onVesselChange"); GameEvents.onVesselChange.Add(OnVesselChange); GameEvents.onInputLocksModified.Add(OnInputLocksModified); ctrlState = new FlightCtrlState(); kerbalState = new KerbalCtrlState(); devices = new List <Device> (); prevMainThrottle = -2; prevMainThrottle = -2; }