private void RefreshCreator() { if (Application.isPlaying) { creator.FillTexture(); } }
public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); DrawDefaultInspector(); if (GUILayout.Button("Update Terrain")) { creator.FillHeights(); //RefreshCreator(); } if (GUILayout.Button("Update Details")) { creator.FillDetails(); } if (GUILayout.Button("Randomize")) { creator.RandomizePosition(); } if (GUILayout.Button("Place Trees")) { creator.PlaceTrees(0); } if (creator.liveHeightmap && EditorGUI.EndChangeCheck()) { creator.FillHeights(); } if (creator.liveTexture && EditorGUI.EndChangeCheck()) { creator.FillTexture(); } }
void Refresh() { if (Application.isPlaying) { m_creator.FillTexture(); } }
public void GenerateTexture() { Random.InitState(FirstName.GetHashCode() + LastName.GetHashCode()); if (m_textureCreator == null) { m_textureCreator = gameObject.AddComponent <TextureCreator>(); } m_textureCreator.resolution = Mathf.RoundToInt(Map(400, 1000, 1, 10, Shy_Outgoing)); m_textureCreator.frequency = Map(1, 25, 1, 10, Serious_Playful); m_textureCreator.octaves = Mathf.RoundToInt(Map(1, 6, 1, 10, Grouchy_Nice)); m_textureCreator.lacunarity = Map(1, 4, 1, 10, Lazy_Active); m_textureCreator.persistence = Map(0, 1, 1, 10, Sloppy_Neat); if (Serious_Playful <= 3) { m_textureCreator.dimensions = 1; } else if (Serious_Playful <= 7) { m_textureCreator.dimensions = 2; } else { m_textureCreator.dimensions = 3; } if (Lazy_Active < 5) { m_textureCreator.type = NoiseMethodType.Value; } else { m_textureCreator.type = NoiseMethodType.Perlin; } // Color GradientColorKey[] gradientColorKeys = new GradientColorKey[Random.Range(3, 6)]; GradientAlphaKey[] gradientAlphaKeys = new GradientAlphaKey[2]; gradientAlphaKeys[0] = new GradientAlphaKey(); gradientAlphaKeys[1] = new GradientAlphaKey(); gradientAlphaKeys[0].time = 0; gradientAlphaKeys[0].alpha = 255; gradientAlphaKeys[1].time = 1; gradientAlphaKeys[1].alpha = 255; for (int i = 0; i < gradientColorKeys.Length; i++) { GradientColorKey gck = new GradientColorKey(); gck.color = Random.ColorHSV(); gck.time = Random.Range(0f, 1f); gradientColorKeys[i] = gck; } m_textureCreator.coloring.SetKeys(gradientColorKeys, gradientAlphaKeys); m_textureCreator.FillTexture(); }
private void PropagateChanges(TextureManager tm) { if (Application.isPlaying) { for (int i = 0; i < tm.transform.GetChildCount(); i++) { Transform folder = tm.transform.GetChild(i); for (int j = 0; j < folder.GetChildCount(); ++j) { TextureCreator go = (TextureCreator)folder.GetChild(j).gameObject.GetComponent <TextureCreator>(); go.resolution = tm.resolution; go.frequency = tm.frequency; go.lacunarity = tm.lacunarity; go.persistence = tm.persistence; go.dimensions = tm.dimensions; go.type = tm.type; go.coloring = tm.coloring; go.repeatable_tiles = tm.repeatable_tiles; go.FillTexture(); } } } }
private void RefreshCreator() { creator.FillTexture(); }