コード例 #1
0
        /// <summary>
        /// Converts a TreePrototype array into a LBTerrainTree list.
        /// Accepts an existing list to reduce GC (can't be NULL else
        /// would need to pass in as a ref.
        /// </summary>
        /// <param name="treePrototypes"></param>
        /// <param name="lbTerrainTreeList"></param>
        public static void ToLBTerrainTreeList(TreePrototype[] treePrototypes, List <LBTerrainTree> lbTerrainTreeList)
        {
            if (lbTerrainTreeList == null)
            {
                return;
            }
            else
            {
                lbTerrainTreeList.Clear();
            }

            int numTreePrototypes = (treePrototypes == null ? 0 : treePrototypes.Length);

            if (lbTerrainTreeList != null)
            {
                for (int i = 0; i < numTreePrototypes; i++)
                {
                    LBTerrainTree temp = new LBTerrainTree();
                    temp.bendFactor = treePrototypes[i].bendFactor;
                    temp.prefab     = treePrototypes[i].prefab;
                    lbTerrainTreeList.Add(temp);
                    temp = null;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Converts a TreePrototype array into a LBTerrainTree list
        /// Added version 1.2
        /// </summary>
        /// <param name="treePrototypes"></param>
        /// <returns></returns>
        public static List <LBTerrainTree> ToLBTerrainTreeList(TreePrototype[] treePrototypes)
        {
            List <LBTerrainTree> terrainTreeList = null;

            if (treePrototypes != null)
            {
                if (treePrototypes.Length > 0)
                {
                    terrainTreeList = new List <LBTerrainTree>();

                    for (int i = 0; i < treePrototypes.Length; i++)
                    {
                        LBTerrainTree temp = new LBTerrainTree();
                        temp.bendFactor = treePrototypes[i].bendFactor;
                        temp.prefab     = treePrototypes[i].prefab;
                        terrainTreeList.Add(temp);
                        temp = null;
                    }
                }
            }

            return(terrainTreeList);
        }
コード例 #3
0
        /// <summary>
        /// Clone Constructor
        /// </summary>
        /// <param name="lbTerrainTree"></param>
        public LBTerrainTree(LBTerrainTree lbTerrainTree)
        {
            this.maxTreesPerSqrKm       = lbTerrainTree.maxTreesPerSqrKm;
            this.bendFactor             = lbTerrainTree.bendFactor;
            this.prefab                 = lbTerrainTree.prefab;
            this.minScale               = lbTerrainTree.minScale;
            this.maxScale               = lbTerrainTree.maxScale;
            this.treeScalingMode        = lbTerrainTree.treeScalingMode;
            this.lockWidthToHeight      = lbTerrainTree.lockWidthToHeight;
            this.minProximity           = lbTerrainTree.minProximity;
            this.minHeight              = lbTerrainTree.minHeight;
            this.maxHeight              = lbTerrainTree.maxHeight;
            this.minInclination         = lbTerrainTree.minInclination;
            this.maxInclination         = lbTerrainTree.maxInclination;
            this.treePlacingMode        = lbTerrainTree.treePlacingMode;
            this.isCurvatureConcave     = lbTerrainTree.isCurvatureConcave;
            this.curvatureDistance      = lbTerrainTree.curvatureDistance;
            this.curvatureMinHeightDiff = lbTerrainTree.curvatureMinHeightDiff;
            this.map                    = lbTerrainTree.map;
            this.mapColour              = lbTerrainTree.mapColour;
            this.mapTolerance           = lbTerrainTree.mapTolerance;
            this.mapInverse             = lbTerrainTree.mapInverse;
            this.useNoise               = lbTerrainTree.useNoise;
            this.noiseTileSize          = lbTerrainTree.noiseTileSize;
            this.noiseOffset            = lbTerrainTree.noiseOffset;
            this.treePlacementCutoff    = lbTerrainTree.treePlacementCutoff;
            this.mapToleranceBlendCurve = lbTerrainTree.mapToleranceBlendCurve;
            this.mapIsPath              = lbTerrainTree.mapIsPath;
            this.isDisabled             = lbTerrainTree.isDisabled;
            this.offsetY                = lbTerrainTree.offsetY;
            this.showTree               = lbTerrainTree.showTree;
            if (lbTerrainTree.filterList != null)
            {
                this.filterList = LBFilter.CopyList(lbTerrainTree.filterList);
            }
            else
            {
                this.filterList = new List <LBFilter>();
            }
            this.isTinted        = lbTerrainTree.isTinted;
            this.maxTintStrength = lbTerrainTree.maxTintStrength;
            this.tintColour      = lbTerrainTree.tintColour;
            if (lbTerrainTree.lbTerrainDataList == null)
            {
                this.lbTerrainDataList = null;
            }
            else
            {
                this.lbTerrainDataList = new List <LBTerrainData>(lbTerrainTree.lbTerrainDataList);
            }
            if (lbTerrainTree.prefabName == null)
            {
                this.prefabName = string.Empty;
            }
            else
            {
                this.prefabName = lbTerrainTree.prefabName;
            }
            this.showPrefabPreview = lbTerrainTree.showPrefabPreview;

            this.GUID = lbTerrainTree.GUID;
        }