コード例 #1
0
    static public string[] GetLayers(MegaShapeLoft loft)
    {
        string[] lyers;
        if (loft)
        {
            MegaLoftLayerSimple[] layers = loft.GetComponents <MegaLoftLayerSimple>();

            lyers = new string[layers.Length + 1];

            lyers[0] = "None";
            for (int i = 0; i < layers.Length; i++)
            {
                lyers[i + 1] = layers[i].LayerName;
            }
        }
        else
        {
            lyers    = new string[1];
            lyers[0] = "None";
        }

        return(lyers);
    }
コード例 #2
0
    static public GUIContent[] GetLayersAsContent(MegaShapeLoft loft)
    {
        GUIContent[] lyers;
        if (loft)
        {
            MegaLoftLayerSimple[] layers = loft.GetComponents <MegaLoftLayerSimple>();

            lyers = new GUIContent[layers.Length + 1];

            lyers[0] = new GUIContent("None");
            for (int i = 0; i < layers.Length; i++)
            {
                lyers[i + 1] = new GUIContent(layers[i].LayerName);
            }
        }
        else
        {
            lyers    = new GUIContent[1];
            lyers[0] = new GUIContent("None");
        }

        return(lyers);
    }
コード例 #3
0
    GameObject CreateSpline(Vector3 pos)
    {
        GameObject obj = new GameObject();

        obj.name = name + " - Spline " + splinecount++;
        obj.transform.position = transform.position;
        //obj.transform.parent = transform;

        MegaShape shape = obj.AddComponent <MegaShape>();

        shape.smoothness  = smooth;
        shape.drawHandles = false;

        MegaSpline spline = shape.splines[0];

        spline.knots.Clear();
        spline.constantSpeed = constantspd;
        spline.subdivs       = 40;

        shape.cap = true;

        Vector3[] ps = new Vector3[2];
        ps[0] = obj.transform.worldToLocalMatrix.MultiplyPoint3x4(pos);
        ps[1] = obj.transform.worldToLocalMatrix.MultiplyPoint3x4(pos);

        shape.BuildSpline(0, ps, false);
        shape.CalcLength();

        shape.drawTwist = true;
        shape.boxwidth  = width;
        shape.boxheight = height;
        shape.offset    = -height * 0.5f;
        shape.stepdist  = meshstep;             //width * 2.0f * 10.0f;

        shape.SetMats();
        spline.closed = closed;

        cspline = spline;
        cshape  = shape;

        if (loft)
        {
            MegaShapeLoft newloft = loft.GetClone();
            newloft.name = name + " - Loft " + (splinecount - 1);
            newloft.transform.position = obj.transform.position;
            newloft.transform.rotation = obj.transform.rotation;

            MegaLoftLayerBase[] layers = newloft.GetComponents <MegaLoftLayerBase>();

            for (int i = 0; i < layers.Length; i++)
            {
                layers[i].layerPath = cshape;
            }

            newloft.rebuild = true;
            //newloft.gameObject.SetActiveRecursively(true);
#if UNITY_3_5
            newloft.gameObject.SetActiveRecursively(true);
#else
            newloft.gameObject.SetActive(true);
#endif

            cloft = newloft;
        }

        return(obj);
    }