Пример #1
0
        public virtual void ToggleHoverMode()
        {
            hoverActive = !hoverActive;
            if (hoverActive)
            {
                ActivateHover();
            }
            else
            {
                DeactivateHover();
            }

            if (this.part.symmetryCounterparts.Count > 0)
            {
                foreach (Part symmetryPart in this.part.symmetryCounterparts)
                {
                    WBIHoverController hoverController = symmetryPart.GetComponent <WBIHoverController>();
                    if (hoverController != null)
                    {
                        if (hoverActive)
                        {
                            hoverController.ActivateHover();
                        }
                        else
                        {
                            hoverController.DeactivateHover();
                        }
                    }
                }
            }
        }
 protected virtual void updateSymmetricalSpeeds()
 {
     if (this.part.symmetryCounterparts.Count > 0)
     {
         foreach (Part symmetryPart in this.part.symmetryCounterparts)
         {
             WBIHoverController hoverController = symmetryPart.GetComponent <WBIHoverController>();
             if (hoverController != null)
             {
                 hoverController.SetVerticalSpeed(this.verticalSpeed);
             }
         }
     }
 }
Пример #3
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            //Get rotor transforms
            rotorTransform = this.part.FindModelTransform(rotorTransformName);

            //Setup engine(s)
            setupEngines();

            //Setup events
            WBIRotationController rotationController = this.part.FindModuleImplementing <WBIRotationController>();

            if (rotationController != null)
            {
                mirrorRotation = rotationController.mirrorRotation;
                rotationController.onRotatorMirrored += MirrorRotation;
            }

            WBIHoverController hoverController = this.part.FindModuleImplementing <WBIHoverController>();

            if (hoverController != null)
            {
                hoverController.onHoverUpdate += onHoverUpdate;
            }

            //Get the rotation axis
            if (string.IsNullOrEmpty(rotorRotationAxis) == false)
            {
                string[] axisValues = rotorRotationAxis.Split(',');
                float    value;
                if (axisValues.Length == 3)
                {
                    if (float.TryParse(axisValues[0], out value))
                    {
                        rotationAxis.x = value;
                    }
                    if (float.TryParse(axisValues[1], out value))
                    {
                        rotationAxis.y = value;
                    }
                    if (float.TryParse(axisValues[2], out value))
                    {
                        rotationAxis.z = value;
                    }
                }
            }

            //Set gui visible state
            SetGUIVisible(guiVisible);

            //Setup actions
            if (!actionsVisible)
            {
                Actions["ToggleThrustTransformAction"].actionGroup = KSPActionGroup.None;
                Actions["ToggleThrustTransformAction"].active      = false;
            }

            //Setup the thrust transform
            if (canReverseThrust)
            {
                fwdThrustTransform = this.part.FindModelTransform(thrustTransform);
                revThrustTransform = this.part.FindModelTransform(reverseThrustTransform);

                if (fwdThrustTransform != null && revThrustTransform != null)
                {
                    SetupThrustTransform();
                    SetupAnimation();
                }

                else
                {
                    Actions["ToggleThrustTransformAction"].actionGroup = KSPActionGroup.None;
                    Events["ToggleThrustTransform"].active             = false;
                    Actions["ToggleThrustTransformAction"].active      = false;
                }
            }
            else
            {
                fwdThrustTransform = this.part.FindModelTransform(thrustTransform);
                revThrustTransform = fwdThrustTransform;
            }

            //Rotor transforms
            setupRotorTransforms();
        }