Ejemplo n.º 1
0
        public override void OnStart(StartState state)
        {
            limitsSet = false;

            if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight)
            {
                return;
            }

            PFUtils.hideDragStuff(part);

            GameEvents.onEditorShipModified.Add(new EventData <ShipConstruct> .OnEvent(onEditorVesselModified));

            if (HighLogic.LoadedSceneIsEditor)
            {
                if (line)
                {
                    line.transform.Rotate(0, 90, 0);
                }

                DestroyAllLineRenderers();

                destroyOutline();

                for (int i = 0; i < outlineSlices; ++i)
                {
                    var r = makeLineRenderer("fairing outline", outlineColor, outlineWidth);

                    outline.Add(r);

                    r.transform.Rotate(0, i * 360f / outlineSlices, 0);
                }

                ShowHideInterstageNodes();

                recalcShape();

                updateDelay = 0.1f;

                needShapeUpdate = true;
            }
            else
            {
                topBasePart = null;

                var adapter = part.GetComponent <ProceduralFairingAdapter>();

                if (adapter)
                {
                    topBasePart = adapter.getTopPart();
                }
                else
                {
                    var scan = scanPayload();

                    if (scan.targets.Count > 0)
                    {
                        topBasePart = scan.targets [0];
                    }
                }
            }

            SetUIChangedCallBacks();

            OnToggleAutoshapeUI();
        }