1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using UnityEngine;
- using System.Collections;
- using System;
- namespace WorldComposer
- {
- [Serializable]
- public class TerrainDetail : MonoBehaviour
- {
- public int heightmapMaximumLOD;
- public float heightmapPixelError;
- public float basemapDistance;
- public bool castShadows;
- public bool draw;
- public float treeDistance;
- public float detailObjectDistance;
- public float detailObjectDensity;
- public float treeBillboardDistance;
- public float treeCrossFadeLength;
- public int treeMaximumFullLODCount;
- public TerrainDetail()
- {
- heightmapPixelError = 5;
- basemapDistance = 50000;
- draw = true;
- treeDistance = 20000;
- detailObjectDistance = 250;
- detailObjectDensity = 1;
- treeBillboardDistance = 200;
- treeCrossFadeLength = 50;
- treeMaximumFullLODCount = 50;
- }
- void Start()
- {
- Terrain terrain = (Terrain)GetComponent(typeof(Terrain));
- terrain.heightmapPixelError = heightmapPixelError;
- terrain.heightmapMaximumLOD = heightmapMaximumLOD;
- if (terrain.GetComponent("ReliefTerrain") == null)
- {
- terrain.basemapDistance = basemapDistance;
- }
- //terrain.castShadows = castShadows;
- if (draw)
- {
- terrain.treeDistance = treeDistance;
- terrain.detailObjectDistance = detailObjectDistance;
- }
- else
- {
- terrain.treeDistance = 0;
- terrain.detailObjectDistance = 0;
- }
- terrain.detailObjectDensity = detailObjectDensity;
- terrain.treeMaximumFullLODCount = treeMaximumFullLODCount;
- terrain.treeBillboardDistance = treeBillboardDistance;
- terrain.treeCrossFadeLength = treeCrossFadeLength;
- terrain.treeMaximumFullLODCount = treeMaximumFullLODCount;
- }
- }
- }
|