Example #1
0
        // Constructors
        public LBWater()
        {
            // Assign a unique identifier
            GUID = System.Guid.NewGuid().ToString();

            // Assign default values
            waterLevel            = 0f;
            waterPosition         = Vector3.zero;
            waterSize             = new Vector2(100f, 100f);
            keepPrefabAspectRatio = false;
            name                   = "secondary water";
            isPrimaryWater         = false;
            waterPrefabName        = "unknown";
            waterPrefabPath        = string.Empty;
            meshBoundsRect         = new Rect();
            meshScale              = new Vector3(1f, 1f, 1f);
            resizingMode           = WaterResizingMode.TransformScaling;
            meshResizingMode       = WaterMeshResizingMode.Custom;
            waterCausticList       = null;
            isDisabled             = false;
            isRiver                = false;
            riverMaterial          = null;
            flowMapTexture         = null;
            riverFlowSpeed         = 1.5f;
            isUnderWaterFXEnabled  = false;
            underWaterFXPrefabName = "unknown";
            underWaterFXPrefabPath = string.Empty;
            waterMaterial          = null;
        }
Example #2
0
        /// <summary>
        /// Clone constructor
        /// </summary>
        public LBWater(LBWater lbWater, bool useNewGUID)
        {
            // Assign a unique identifier
            if (useNewGUID)
            {
                GUID = System.Guid.NewGuid().ToString();
            }
            else
            {
                this.GUID = lbWater.GUID;
            }

            // Assign default values
            waterLevel            = lbWater.waterLevel;
            waterPosition         = lbWater.waterPosition;
            waterSize             = lbWater.waterSize;
            keepPrefabAspectRatio = lbWater.keepPrefabAspectRatio;
            name             = lbWater.name;
            isPrimaryWater   = lbWater.isPrimaryWater;
            waterPrefabName  = lbWater.waterPrefabName;
            waterPrefabPath  = lbWater.waterPrefabPath;
            meshBoundsRect   = lbWater.meshBoundsRect;
            meshScale        = lbWater.meshScale;
            resizingMode     = lbWater.resizingMode;
            meshResizingMode = lbWater.meshResizingMode;
            if (waterCausticList != null)
            {
                waterCausticList = new List <LBWaterCaustics>(lbWater.waterCausticList);
            }
            else
            {
                waterCausticList = null;
            }
            isDisabled             = lbWater.isDisabled;
            isRiver                = lbWater.isRiver;
            riverMaterial          = lbWater.riverMaterial;
            flowMapTexture         = lbWater.flowMapTexture;
            riverFlowSpeed         = lbWater.riverFlowSpeed;
            isUnderWaterFXEnabled  = lbWater.isUnderWaterFXEnabled;
            underWaterFXPrefabName = lbWater.underWaterFXPrefabName;
            underWaterFXPrefabPath = lbWater.underWaterFXPrefabPath;

            // Changed v1.4.4 (To create a true clone we should create a new copy of the material)
            // This will break any links with the original material. Not sure if we want to do this...
            //waterMaterial = lbWater.waterMaterial;
            if (waterMaterial != null)
            {
                waterMaterial = new Material(lbWater.waterMaterial);
            }
            else
            {
                waterMaterial = null;
            }
        }