Ejemplo n.º 1
0
        private void GenerateMesh()
        {
            UOUtility.DestroyChildren(generated);

            int   i             = 0;
            float textureOffset = 0.0f;

            foreach (CubicBezierCurve curve in spline.GetCurves())
            {
                GameObject go = UOUtility.Create("segment " + i++,
                                                 generated,
                                                 typeof(MeshFilter),
                                                 typeof(MeshRenderer),
                                                 typeof(ExtrusionSegment),
                                                 typeof(MeshCollider));
                go.isStatic = true; // TODO Changed
                go.GetComponent <MeshRenderer>().material = material;
                ExtrusionSegment mb = go.GetComponent <ExtrusionSegment>();
                mb.ShapeVertices = shapeVertices;
                mb.TextureScale  = textureScale;
                mb.TextureOffset = textureOffset;
                mb.SampleSpacing = sampleSpacing;
                mb.SetInterval(curve);

                textureOffset += curve.Length;
            }
        }
Ejemplo n.º 2
0
        private void GenerateMesh()
        {
            UOUtility.DestroyChildren(generated);

            _bounds = new Bounds();
            int   i             = 0;
            float textureOffset = 0.0f;

            foreach (CubicBezierCurve curve in spline.GetCurves())
            {
                GameObject go = UOUtility.Create("segment " + i++,
                                                 generated,
                                                 typeof(MeshFilter),
                                                 typeof(MeshRenderer),
                                                 typeof(ExtrusionSegment),
                                                 typeof(MeshCollider));
                go.GetComponent <MeshRenderer>().material = material;
                ExtrusionSegment mb = go.GetComponent <ExtrusionSegment>();
                mb.SetShapeVertices(shapeVertices, false);
                mb.SetLoopAround(loopAround, false);
                mb.SetTextureScale(textureScale, false);
                mb.SetCurve(curve, true);
                mb.SetTextureOffset(textureOffset, true);
                textureOffset += curve.Length;
                _bounds.Encapsulate(go.GetComponent <MeshFilter>().sharedMesh.bounds);
            }
        }
Ejemplo n.º 3
0
        private void GenerateMesh()
        {
            float textureOffset = 0.0f;

            generated.GetComponent <MeshRenderer>().material = material;
            ExtrusionSegment mb = generated.GetComponent <ExtrusionSegment>();

            //mb.ShapeVertices = shapeVertices;
            //mb.TextureScale = textureScale;
            //mb.TextureOffset = textureOffset;
            mb.SampleSpacing = sampleSpacing;
            //mb.SetInterval(curve);

            //textureOffset += curve.Length;
        }
Ejemplo n.º 4
0
        private void GenerateMesh()
        {
            UOUtility.DestroyChildren(generated);

            int i = 0;

            foreach (CubicBezierCurve curve in spline.GetCurves())
            {
                GameObject go = UOUtility.Create("segment " + i++,
                                                 generated,
                                                 typeof(MeshFilter),
                                                 typeof(MeshRenderer),
                                                 typeof(ExtrusionSegment),
                                                 typeof(MeshCollider));
                go.GetComponent <MeshRenderer>().material = material;
                ExtrusionSegment mb = go.GetComponent <ExtrusionSegment>();
                mb.SetShapeVertices(shapeVertices, false);
                mb.SetTextureScale(textureScale, false);
                mb.SetCurve(curve, true);
            }
        }
Ejemplo n.º 5
0
        protected void GenerateMesh()
        {
            UOUtility.DestroyChildren(generated);

            int   i             = 0;
            float textureOffset = 0.0f;

            foreach (CubicBezierCurve curve in spline.GetCurves())
            {
                GameObject go = UOUtility.Create("segment " + i++,
                                                 generated,
                                                 typeof(MeshFilter),
                                                 typeof(MeshRenderer),
                                                 typeof(ExtrusionSegment),
                                                 typeof(MeshCollider));
                MeshRenderer goRenderer = go.GetComponent <MeshRenderer>();
                goRenderer.material = material;
                ExtrusionSegment seg = go.GetComponent <ExtrusionSegment>();
                seg.ShapeVertices = shapeVertices;
                seg.TextureScale  = textureScale;
                seg.TextureOffset = textureOffset;
                seg.SampleSpacing = sampleSpacing;
                seg.SetInterval(curve);
                goRenderer.enabled = visible;
                if (go.TryGetComponent(out MeshCollider meshCollider))
                {
                    meshCollider.enabled = collisionEnabled;
                }
                int layerNum = LayerMask.NameToLayer(layer);
                if (layerNum > -1)
                {
                    go.gameObject.layer = layerNum;
                }

                textureOffset += curve.Length;
            }
        }