private void drawMotorControls(KSPWheelMotor motor) { float val = 0f; if (GUILayout.Button("Invert Motor: " + motor.invertMotor, GUILayout.Width(w3))) { motor.invertMotor = !motor.invertMotor; motor.onMotorInvert(null, null); } if (GUILayout.Button("Lock Motor: " + motor.motorLocked, GUILayout.Width(w3))) { motor.motorLocked = !motor.motorLocked; motor.onMotorLock(null, null); } GUILayout.Label("Motor Limit", GUILayout.Width(w3)); val = GUILayout.HorizontalSlider(motor.motorOutput, 0, 100, GUILayout.Width(w2)); if (val != motor.motorOutput) { motor.motorOutput = val; motor.onMotorLimitUpdated(null, null); } if (GUILayout.Button("<", GUILayout.Width(w1))) { motor.gearRatio = Mathf.Clamp(motor.gearRatio - 1f, 1f, 20f); motor.onGearUpdated(null, null); } GUILayout.Label("Gear: " + motor.gearRatio); if (GUILayout.Button(">", GUILayout.Width(w1))) { motor.gearRatio = Mathf.Clamp(motor.gearRatio + 1f, 1f, 20f); motor.onGearUpdated(null, null); } if (motor.tankSteering) { if (GUILayout.Button("Lock Steering: " + motor.steeringLocked, GUILayout.Width(w3))) { motor.steeringLocked = !motor.steeringLocked; motor.onSteeringLock(null, null); } if (GUILayout.Button("Invert Steering: " + motor.invertSteering, GUILayout.Width(w3))) { motor.invertSteering = !motor.invertSteering; motor.onSteeringInvert(null, null); } if (GUILayout.Button("Half Track Mode: " + motor.halfTrackSteering, GUILayout.Width(w3))) { motor.halfTrackSteering = !motor.halfTrackSteering; motor.onHalftrackToggle(null, null); } } }
public void Start() { motor = part.transform.GetComponent <KSPWheelMotor>(); }
internal override void postWheelCreated() { base.postWheelCreated(); motor = part.GetComponent <KSPWheelMotor>(); }