void DrawFoliageInstancesEditingUI() { EditorGUILayout.BeginVertical("Box", GUILayout.Width(450), GUILayout.MaxHeight(200)); GUILayout.Label("Chunks Settings:", EditorStyles.boldLabel); GUILayout.Space(10); if (selectedChunk == null) { GUILayout.Label("Chunk cannot be found!"); } else { if (!selectedChunk.isFoliageInstanceAttached) { GUILayout.Label("Chunk doesn't have a manager attached!"); } else { FoliageManagerInstance mInstance = selectedChunk.GetOrCreateFoliageManagerInstance(); mInstance.foliageAreaResolution = (FoliageResolutions)EditorGUILayout.EnumPopup("Foliage Area Resolution", mInstance.foliageAreaResolution); GUILayout.BeginHorizontal(); GUILayout.Label("World Maps Settings", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); if (GUILayout.Button("Generate")) { mInstance.worldMap = UNMapGenerators.GenerateWorldMap(mInstance); } GUILayout.EndHorizontal(); mInstance.worldMap.map = (Texture2D)EditorGUILayout.ObjectField(string.Format("World Map: ({0})", mInstance.foliageAreaResolutionIntegral), mInstance.worldMap.map, typeof(Texture2D), false); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Label("Color Maps Settings", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); if (GUILayout.Button("Generate")) { mInstance.colorMap = UNMapGenerators.GenerateColorMap(0, 0, FoliageCore_MainManager.FOLIAGE_INSTANCE_AREA_SIZE, mInstance.guid); } GUILayout.EndHorizontal(); mInstance.colorMap = (Texture2D)EditorGUILayout.ObjectField(string.Format("Color Map: ({0})", FoliageCore_MainManager.FOLIAGE_INSTANCE_AREA_SIZE), mInstance.colorMap, typeof(Texture2D), false); } } EditorGUILayout.EndVertical(); }
protected override void Update() { if (!Application.isPlaying) { return; } base.Update(); FoliageCore_Chunk midChunk = middleFoliageChunkFromNeighbors; // middle chunk FoliageManagerInstance mInstance; if ((!wasPositionChecked || Vector3.Distance(lastCheckedPosition, transform.position) >= checkDistance) && isGrassReceiver && midChunk != null && midChunk.isFoliageInstanceAttached) { //latestChunk = FoliageManager.instance.sector.getChunk(new Vector3(transform.position.x - FoliageManager.instance.transform.position.x, 0, transform.position.z - FoliageManager.instance.transform.position.z), 0) as FoliageChunk; mInstance = midChunk.GetOrCreateFoliageManagerInstance(); latestChunk = mInstance.sector.getChunk(new Vector3(transform.position.x - mInstance.transform.position.x, 0, transform.position.z - mInstance.transform.position.z), 0) as FoliageChunk; _neighbors = UNStandaloneUtility.GetFoliageChunksNeighbors(transform.position - FoliageCore_MainManager.instance.transform.position, _neighbors); wasPositionChecked = true; lastCheckedPosition = transform.position; } }
private void DebugGlobalSettings() { GUILayout.Space(10); GUILayout.Label(string.Format("Global Settings: (Frame: {0})", Time.frameCount), UNStandaloneUtility.boldLabel); GUILayout.Space(5); UNStandaloneUtility.BeginHorizontalOffset(25); GUILayout.Label(string.Format("Current Grided-Position : {0} ({1})", latestManagerChunk == null ? "Out Of Bounds" : latestManagerChunk.transform.position.ToString(), latestManagerChunk == null ? "NaN" : latestManagerChunk.isFoliageInstanceAttached ? latestManagerChunk.GetOrCreateFoliageManagerInstance().foliageAreaResolutionIntegral.ToString() : "Not Poppulated")); GUILayout.Label("Foliage Shadow Distance: " + (FoliageCore_MainManager.instance.useQualitySettingsShadowDistance ? QualitySettings.shadowDistance : FoliageCore_MainManager.instance.foliageShadowDistance)); GUILayout.Label("Foliage Foliage Density: " + FoliageCore_MainManager.instance.density); UNStandaloneUtility.EndHorizontalOffset(); }