Esempio n. 1
0
        /// <summary>
        /// Displays GUI elements for the "Noise" tab
        /// </summary>
        public void Noise()
        {
            NoiseGraph graph = Settings.Graph;

            EditorGUILayout.Space();

            //Check if graph is loaded and assign generator
            //from end node
            if (graph == null)
            {
                const string msg = "A node graph asset file must be attached to 'Graph' before " +
                                   "terrain can be generated.";
                EditorGUILayout.HelpBox(msg, MessageType.Warning);
            }

            //Display message if the generator failed to load
            //OR display message about a successful load
            if (graph != null && graph.GetEndGenerator() == null)
            {
                const string msg = "The attached node graph either does not have a supplied End node " +
                                   "or the End node is missing its input.";
                EditorGUILayout.HelpBox(msg, MessageType.Warning);
            }
            else if (graph != null && graph.GetEndGenerator() != null)
            {
                const string msg = "Hooray! The attached node graph is ready for use.";
                EditorGUILayout.HelpBox(msg, MessageType.Info);
            }

            EditorGUILayout.Space();
            Settings.Graph = (NoiseGraph)EditorGUILayout.ObjectField("Graph", graph, typeof(NoiseGraph), false);
            EditorGUILayout.Space();

            Settings.Spread    = EditorGUILayout.FloatField("Spread", Settings.Spread);
            Settings.Amplitude = EditorGUILayout.FloatField("Amplitude", Settings.Amplitude);

            EditorGUILayout.Space();
            if (Application.isEditor && Settings.DisplayPreview)
            {
                if (GUILayout.Button("Update Preview"))
                {
                    Settings.Preview.TriggerPreviewUpdate();
                }
            }
        }