public void UpdateTreesAroundEditorCamera() { if (mainCam == null && !Application.isPlaying) { mainCam = SceneView.GetAllSceneCameras()[0]; } terrain = FindObjectOfType <TerrainConstructor>(); CheckTrees(); }
private void Start() { mainCam = Camera.main; if (commonTreePool == null) { CreateTreePool(); } terrain = FindObjectOfType <TerrainConstructor>(); CheckTrees(); StartCoroutine(CheckPlayerPosition()); }
public void ArrangeChunks() { terrain = GetComponent <TerrainConstructor>(); chunks = new TerrainChunk[Data.xSize / chunkSize + 1, Data.zSize / chunkSize + 1]; for (int x = 0; x < chunks.GetLength(0); x++) { for (int z = 0; z < chunks.GetLength(1); z++) { GameObject chunkObject = new GameObject("Chunk"); chunks[x, z] = new TerrainChunk(chunkObject); } } for (int x = 0; x < Data.xSize; x++) { for (int z = 0; z < Data.zSize; z++) { //chunks[x / Data.xSize, z / Data.zSize].baseTiles.Add(Data.GetTileAtCoordinates(x, z).Transform.gameObject); } } }
public override void OnInspectorGUI() { TerrainConstructor terrain = (TerrainConstructor)target; DrawDefaultInspector(); if (GUILayout.Button("Generate Terrain")) { terrain.GenerateTerrain(); EditorUtility.SetDirty(terrain); } if (GUILayout.Button("Generate Flora")) { terrain.GenerateFlora(); EditorUtility.SetDirty(terrain); } if (GUILayout.Button("Construct Terrain")) { terrain.ClearTerrain(); terrain.ConstructTerrain(); EditorUtility.SetDirty(terrain); } if (GUILayout.Button("Clear All")) { terrain.ClearTerrain(); EditorUtility.SetDirty(terrain); } if (GUILayout.Button("Save Terrain")) { TerrainSaver.SaveTerrain(terrain.terrainData, terrain.terrainFileName); } if (GUILayout.Button("Load Terrain")) { TerrainData data = TerrainSaver.LoadTerrain(terrain.terrainFileName); terrain.terrainData = data; terrain.ConstructTerrain(); } serializedObject.Update(); serializedObject.ApplyModifiedProperties(); }
// Start is called before the first frame update void Start() { instance = this; GenerateRooms(); ArrangeRooms(); DrawRooms(); Vector2Int spawnPos = DrawCorridors(); DrawWalls(); if (drawRoomCenters) { DrawCenters(); } SpawnExit(spawnPos); InstantiatePlayables(spawnPos); }
public void Start() { terrainConstructor = TerrainConstructor.instance; }