Ejemplo n.º 1
0
        private void CleanUp()
        {
            foreach (RenderTexture rt in ReflRenderTextures.Values)
            {
                if (rt == null)
                {
                    continue;
                }
                rt.Release();
                PUtilities.DestroyObject(rt);
            }

            foreach (Camera cam in ReflCameras.Values)
            {
                if (cam == null)
                {
                    continue;
                }
                PUtilities.DestroyGameobject(cam.gameObject);
            }

            if (mesh != null)
            {
                PUtilities.DestroyObject(mesh);
            }

            if (spline != null)
            {
                spline.Dispose();
            }
        }
Ejemplo n.º 2
0
        public override void Apply()
        {
            if (SplineCreator == null && Water == null)
            {
                return;
            }
            if (Water.MeshType != PWaterMeshType.Spline)
            {
                return;
            }

            GSpline gSpline = SplineCreator.Spline;
            PSpline pSpline = Water.Spline;

            pSpline.Dispose();
            pSpline.Anchors.Clear();
            pSpline.Segments.Clear();

            for (int i = 0; i < gSpline.Anchors.Count; ++i)
            {
                PSplineAnchor a = (PSplineAnchor)gSpline.Anchors[i];
                a.Position += Vector3.up * HeightOffset;
                pSpline.Anchors.Add(a);
            }

            for (int i = 0; i < gSpline.Segments.Count; ++i)
            {
                PSplineSegment s = (PSplineSegment)gSpline.Segments[i];
                s.StartTangent += Vector3.up * HeightOffset;
                s.EndTangent   += Vector3.up * HeightOffset;
                pSpline.Segments.Add(s);
            }

            Water.transform.position   = transform.position;
            Water.transform.rotation   = transform.rotation;
            Water.transform.localScale = transform.localScale;
            Water.SplineWidth          = SplineCreator.Width + SplineCreator.FalloffWidth * 2;
            Water.GenerateSplineMesh();
            Water.ReCalculateBounds();
        }