public void ApplyTrees(TCUnityTerrain sTerrain = null) { if (!CheckValidUnityTerrain()) { return; } if (sTerrain == null) { sTerrain = this; } if (sTerrain.treePrototypes.Count == 0) { ResetTrees(); } List <TreePrototype> treePrototypesCleaned = new List <TreePrototype>(); for (int i = 0; i < sTerrain.treePrototypes.Count; i++) { TC_TreePrototype s = sTerrain.treePrototypes[i]; if (s.prefab == null) { continue; } TreePrototype d = new TreePrototype(); d.bendFactor = s.bendFactor; d.prefab = s.prefab; treePrototypesCleaned.Add(d); } terrain.terrainData.treePrototypes = treePrototypesCleaned.ToArray(); }
public void SwapTree(int index1, int index2) { if (index2 >= 0 && index2 < treePrototypes.Count) { TC_TreePrototype treePrototype2 = treePrototypes[index1]; treePrototypes[index1] = treePrototypes[index2]; treePrototypes[index2] = treePrototype2; } }
public void GetTrees() { if (!CheckValidUnityTerrain()) { return; } treePrototypes.Clear(); for (int i = 0; i < terrain.terrainData.treePrototypes.Length; i++) { TreePrototype s = terrain.terrainData.treePrototypes[i]; TC_TreePrototype d = new TC_TreePrototype(); d.bendFactor = s.bendFactor; d.prefab = s.prefab; treePrototypes.Add(d); } }
public void CopyTree(TC_TreePrototype treePrototype1, TC_TreePrototype treePrototype2) { treePrototype2.prefab = treePrototype1.prefab; treePrototype2.bendFactor = treePrototype1.bendFactor; }