protected override void OnInspector()
        {
            var markAsDirty = false;

            markAsDirty |= SgtTerrain_Editor <SgtTerrain> .DrawArea(serializedObject.FindProperty("area"), Target.GetComponent <SgtTerrain>());

            EditorGUILayout.Separator();

            BeginError(Any(t => t.Frequency == 0.0));
            Draw("frequency", ref markAsDirty, "The amount of peaks and valleys across the mesh.");
            EndError();
            BeginError(Any(t => t.Amplitude == 0.0));
            Draw("amplitude", ref markAsDirty, "The maximum +- displacement of the first octave.\n\nNOTE: The final displacement may be greater than this range when using multiple octaves.");
            EndError();
            Draw("ridged", ref markAsDirty, "Use ridged simplex noise?");
            Draw("seed", ref markAsDirty, "The random noise seed.");
            Draw("octaves", ref markAsDirty, "The amount of noise layers.");

            if (markAsDirty == true)
            {
                serializedObject.ApplyModifiedProperties();

                Each(t => t.MarkAsDirty());
            }
        }
예제 #2
0
        protected override void OnInspector()
        {
            var markAsDirty = false;

            markAsDirty |= SgtTerrain_Editor <SgtTerrain> .DrawArea(serializedObject.FindProperty("area"), Target.GetComponent <SgtTerrain>());

            Draw("threshold", ref markAsDirty, "If the prefabs are set to spawn in a specific area, this allows you to specify how far into the area you must travel before prefabs begin spawning.");

            Separator();

            Draw("limit", ref markAsDirty, "The maximum amount of prefabs that can spawn per chunk.");
            BeginError(Any(t => t.Resolution <= 0.0));
            Draw("resolution", ref markAsDirty, "The terrain will be split into this many cells on each axis.");
            EndError();
            Draw("radius", ref markAsDirty, "The radius in chunks around the camera that will have colliders.\n\n1 = 3x3 chunks.\n\n2 = 5x5 chunks.\n\n3 = 7x7 chunks.");

            Separator();

            Draw("rotate", ref markAsDirty, "How should the spawned prefabs be rotated?");
            Draw("sharedMaterial", ref markAsDirty, "If your terrain has an atmosphere/corona and your spawned objects are large enough to be covered by it, then specify its SgtSharedMaterial here.");
            BeginError(Any(t => t.Prefabs.Count == 0 || t.Prefabs.Exists(p => p == null) == true));
            Draw("prefabs", ref markAsDirty, "The prefabs that will be spawned.");
            EndError();

            if (markAsDirty == true)
            {
                DirtyEach(t => t.MarkAsDirty());
            }
        }