コード例 #1
0
 private void SetTexture()
 {
     if (part != null && part.HasModule<ProceduralPart>()) {
         ProceduralPart pp = part.GetModule<ProceduralPart>();
         if (pp != null) {
             pp.textureSet = Settings.Instance.DefaultTexture;
         }
     }
 }
コード例 #2
0
        private float opposingDiameter(AttachNode an)
        {
            AttachNode oppo = ReallyFindOpposingNode(an);

            if (oppo != null)
            {
                if (oppo.owner != null && oppo.owner.Modules.Contains <ProceduralPart>())
                {
                    ProceduralPart oppoPP = oppo.owner.Modules.GetModule <ProceduralPart>();
                    switch (oppoPP.shapeName)
                    {
                    case "Cylinder":
                        return(oppo.owner.Modules.GetModule <ProceduralShapeCylinder>().diameter);

                    case "Curved":                             // Only used by the decoupler
                    case "Fillet Cylinder":
                        return(oppo.owner.Modules.GetModule <ProceduralShapePill>().diameter);

                    case "Cone":
                        switch (an.id)
                        {
                        case "top":
                            return(oppo.owner.Modules.GetModule <ProceduralShapeCone>().bottomDiameter);

                        case "bottom":
                            return(oppo.owner.Modules.GetModule <ProceduralShapeCone>().topDiameter);
                        }
                        break;

                    case "Smooth Cone":
                        switch (an.id)
                        {
                        case "top":
                            return(oppo.owner.Modules.GetModule <ProceduralShapeCone>().bottomDiameter);

                        case "bottom":
                            return(oppo.owner.Modules.GetModule <ProceduralShapeCone>().topDiameter);
                        }
                        break;
                    }
                }
                switch (oppo.size)
                {
                case 0:  return(0.625f);

                case 2:  return(treat2As1p5(oppo) ? 1.875f : 2.5f);

                default: return(1.25f * oppo.size);
                }
            }
            return(0f);
        }
コード例 #3
0
 private bool SetShape <T>() where T : ProceduralAbstractShape
 {
     if (part.Modules.Contains <ProceduralPart>() && part.Modules.Contains <T>())
     {
         ProceduralPart pp = part.Modules.GetModule <ProceduralPart>();
         T shape           = part.Modules.GetModule <T>();
         if (pp.shapeName != shape.displayName)
         {
             pp.SetShapeName(shape.displayName);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #4
0
 private bool SetShape <T>() where T : ProceduralAbstractShape
 {
     if (part.HasModule <ProceduralPart>() && part.HasModule <T>())
     {
         ProceduralPart pp = part.GetModule <ProceduralPart>();
         T shape           = part.GetModule <T>();
         if (pp.shapeName != shape.displayName)
         {
             pp.shapeName = shape.displayName;
             // Give the module a chance to update before we do anything else
             pp.Update();
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }