コード例 #1
0
 internal override void postWheelCreated()
 {
     base.postWheelCreated();
     if (part.symmetryCounterparts != null && part.symmetryCounterparts.Count > 0)
     {
         //this must be a clone, or part is being reloaded
         //the 'symmetry counterpart' that exists should be the original part
         this.isFlipped = !part.symmetryCounterparts[0].GetComponent <KSPWheelAdjustableGear>().isFlipped;
     }
     if (HighLogic.LoadedSceneIsFlight)
     {
         tempCollider                    = new GameObject("StandInCollider").AddComponent <SphereCollider>();
         tempCollider.radius             = wheel.radius;
         tempCollider.gameObject.layer   = 26;
         tempCollider.transform.parent   = suspensionTarget;
         tempCollider.transform.position = wheel.transform.position;
         CollisionManager.IgnoreCollidersOnVessel(vessel, tempCollider);//have to run this before the collider is disabled
         tempCollider.enabled = controller.wheelState == KSPWheelState.RETRACTING || controller.wheelState == KSPWheelState.DEPLOYING;
         KSPWheelSteering steering = part.GetComponent <KSPWheelSteering>();
         if (steering != null)
         {
             steering.maxSteeringAngle = Mathf.Abs(wheelRotation) < 0.25f ? maxSteeringAngle : 0;
         }
     }
     updateAnimation(0f);//force update the animation based on current time
 }
コード例 #2
0
        private void drawSteeringControls(KSPWheelSteering steering)
        {
            if (GUILayout.Button("Invert: " + steering.invertSteering))
            {
                steering.invertSteering = !steering.invertSteering;
                steering.onSteeringInverted(null, null);
            }
            if (GUILayout.Button("Lock: " + steering.steeringLocked))
            {
                steering.steeringLocked = !steering.steeringLocked;
                steering.onSteeringLocked(null, null);
            }
            float val = 0f;

            GUILayout.Label("Low Speed Limit", GUILayout.Width(w3));
            val = GUILayout.HorizontalSlider(steering.steeringLimit, 0, 1, GUILayout.Width(w2));
            if (val != steering.steeringLimit)
            {
                steering.steeringLimit = val;
                steering.onSteeringLimitUpdated(null, null);
            }
            GUILayout.Label("High Speed Limit", GUILayout.Width(w3));
            val = GUILayout.HorizontalSlider(steering.steeringLimitHigh, 0, 1, GUILayout.Width(w2));
            if (val != steering.steeringLimitHigh)
            {
                steering.steeringLimitHigh = val;
                steering.onSteeringLimitUpdated(null, null);
            }
            GUILayout.Label("Response Speed", GUILayout.Width(w3));
            val = GUILayout.HorizontalSlider(steering.steeringResponse, 0, 1, GUILayout.Width(w2));
            if (val != steering.steeringResponse)
            {
                steering.steeringResponse = val;
                steering.onSteeringLimitUpdated(null, null);
            }
            GUILayout.Label("Bias", GUILayout.Width(w3));
            val = GUILayout.HorizontalSlider(steering.steeringBias, 0, 1, GUILayout.Width(w2));
            if (val != steering.steeringBias)
            {
                steering.steeringBias = val;
                steering.onSteeringBiasUpdated(null, null);
            }
        }