Exemple #1
0
        public void setup()
        {
            //Get rid of decoupler shroud module if no top node found
            if (destroyShroudIfNoTopNode())
            {
                return;
            }

            starDragCubes = part.DragCubes;
            getTextureNames();

            //Remove copied decoupler shroud when copied
            Transform copiedDecouplerShroud = transform.FindChild("DecouplerShroud");

            if (copiedDecouplerShroud != null)
            {
                Destroy(copiedDecouplerShroud.gameObject);
                shroudCylinders = null;
            }

            //Set up events
            part.OnEditorAttach += partReattached;
            part.OnEditorDetach += partDetached;

            Fields[nameof(shroudEnabled)].OnValueModified  += activeToggled;
            Fields[nameof(autoDetectSize)].OnValueModified += setButtonActive;
            Fields[nameof(autoDetectSize)].OnValueModified += detectSize;

            Fields[nameof(topWidth)].OnValueModified     += updateShroud;
            Fields[nameof(botWidth)].OnValueModified     += updateShroud;
            Fields[nameof(height)].OnValueModified       += updateShroud;
            Fields[nameof(thickness)].OnValueModified    += updateShroud;
            Fields[nameof(vertOffset)].OnValueModified   += updateShroud;
            Fields[nameof(textureIndex)].OnValueModified += updateTexture;

            setButtonActive();

            if (HighLogic.LoadedSceneIsFlight)
            {
                createShroudGO();
                if (GetShroudedPart() != null && shroudEnabled)
                {
                    GetShroudedPart().AddShield(this);
                }
            }
            else
            {
                if (part.isAttached)
                {
                    createShroudGO();
                }
            }
            detectSize();
            setupFinished = true;
        }
        public void setup()
        {
            //Debug.Log("[Decoupler Shroud] jet: " + jettisoned + ", attached: " + part.isAttached + ", inv: "+invisibleShroud);

            //Get rid of decoupler shroud module if no top node found
            if (destroyShroudIfNoTopNode())
            {
                return;
            }

            segmentIndex   = Mathf.Clamp(segmentIndex, 0, segmentCountLUT.Length - 1);
            segments       = segmentCountLUT[segmentIndex];
            collPerSegment = collPerSegmentLUT[segmentIndex];
            //Debug.Log("!!set segment count to: " + segments + ", Index: " + segmentIndex);

            getTextureNames();
            //Remove copied decoupler shroud when copied
            Transform copiedDecouplerShroud = part.FindModelComponent <Transform>().Find(DECOUPLERSHROUD_GO_NAME);

            if (copiedDecouplerShroud != null)
            {
                Destroy(copiedDecouplerShroud.gameObject);
                shroudShaper = null;
            }

            //Set up events
            part.OnEditorAttach += partReattached;
            part.OnEditorDetach += partDetached;

            Fields[nameof(shroudEnabled)].OnValueModified  += activeToggled;
            Fields[nameof(autoDetectSize)].OnValueModified += setButtonActive;
            Fields[nameof(autoDetectSize)].OnValueModified += detectSize;

            Fields[nameof(topWidth)].OnValueModified     += updateShroud;
            Fields[nameof(botWidth)].OnValueModified     += updateShroud;
            Fields[nameof(height)].OnValueModified       += updateShroud;
            Fields[nameof(thickness)].OnValueModified    += updateShroud;
            Fields[nameof(vertOffset)].OnValueModified   += updateShroud;
            Fields[nameof(textureIndex)].OnValueModified += changeMaterial;

            Fields[nameof(segmentIndex)].OnValueModified += segmentUpdate;

            setButtonActive();

            if (HighLogic.LoadedSceneIsFlight)
            {
                if (GetShroudedPart() != null && shroudEnabled)
                {
                    GetShroudedPart().AddShield(this);
                }
            }
            createNewShroudGO();
            //detectSize();
            setupFinished = true;
        }
Exemple #3
0
 //Generates the shroud for the first time
 void generateShroud()
 {
     shroudCylinders = new ShroudShaper(this, nSides);
     shroudCylinders.generate();
 }
 //Generates the shroud for the first time
 void generateShroud()
 {
     shroudCylinders = new ShroudShaper(nSides);
     shroudCylinders.generate(vertOffset, height, botWidth, topWidth, thickness);
 }
 //Generates the shroud for the first time
 void generateShroud()
 {
     shroudShaper = new ShroudShaper(this, nSides);
     shroudShaper.generate();
 }