예제 #1
0
    void Start()
    {
        terrianGenerator = FindObjectOfType <TerrianGenerator>();

        maxVisibleDistance     = detailLevels[detailLevels.Length - 1].visibleDstThreshold;
        terrianSize            = TerrianGenerator.terrianSize - 1;
        chunksVisibleInViewDst = Mathf.RoundToInt(maxVisibleDistance / terrianSize);

        UpdateVisibleChunks();
    }
예제 #2
0
 private void Start()
 {
     if (instance != null && instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
     }
 }
예제 #3
0
    public override void OnInspectorGUI()
    {
        TerrianGenerator mapGen = (TerrianGenerator)target;

        if (DrawDefaultInspector())
        {
            if (mapGen.autoUpdate)
            {
                mapGen.DrawTerrianInEditor();
            }
        }

        if (GUILayout.Button("Generate"))
        {
            mapGen.DrawTerrianInEditor();
        }
    }
예제 #4
0
 private void OnDestroy()
 {
     instance = null;
 }
예제 #5
0
 public MeshDetailLevel(int level, System.Action updateCallback, TerrianGenerator terrianGenerator)
 {
     this.terrianGenerator = terrianGenerator;
     this.level            = level;
     this.updateCallback   = updateCallback;
 }