void Start() { terrianGenerator = FindObjectOfType <TerrianGenerator>(); maxVisibleDistance = detailLevels[detailLevels.Length - 1].visibleDstThreshold; terrianSize = TerrianGenerator.terrianSize - 1; chunksVisibleInViewDst = Mathf.RoundToInt(maxVisibleDistance / terrianSize); UpdateVisibleChunks(); }
private void Start() { if (instance != null && instance != this) { Destroy(gameObject); } else { instance = this; } }
public override void OnInspectorGUI() { TerrianGenerator mapGen = (TerrianGenerator)target; if (DrawDefaultInspector()) { if (mapGen.autoUpdate) { mapGen.DrawTerrianInEditor(); } } if (GUILayout.Button("Generate")) { mapGen.DrawTerrianInEditor(); } }
private void OnDestroy() { instance = null; }
public MeshDetailLevel(int level, System.Action updateCallback, TerrianGenerator terrianGenerator) { this.terrianGenerator = terrianGenerator; this.level = level; this.updateCallback = updateCallback; }