Inheritance: UnityEngine.MonoBehaviour
Ejemplo n.º 1
0
        /// <summary>
        /// Initialize component
        /// </summary>
        public void Initialize()
        {
            m_instance = this;

            if (!m_gameObject)
            {
                m_gameObject = GetComponent <GameObject>();
            }
            if (!m_transform)
            {
                m_transform = GetComponent <Transform>();
            }

            m_terrain = GetComponent <Terrain>();
            if (Terrain == null)
            {
                return;
            }                                // { throw new NullReferenceException(Settings.ErrorMessages.NO_TERRAIN_COMPONENT); }

            m_terrainData = m_terrain.terrainData;
            if (TerrainData == null)
            {
                return;
            }                                    // { throw new NullReferenceException(Settings.ErrorMessages.NO_TERRAIN_DATA_COMPONENT); }

            if (m_alpha == null)
            {
                m_alpha = new tp_Alpha();
            }
            if (m_heights == null)
            {
                m_heights = new tp_Heights();
            }
            if (m_history == null)
            {
                m_history = new tp_History();
            }
            if (m_ramp == null)
            {
                m_ramp = new tp_MinMax(45.0f, 65.0f);
            }
            if (m_textures == null)
            {
                m_textures = new tp_Textures();
            }
            if (m_foliages == null)
            {
                m_foliages = new tp_Foliages();
            }

            SafeTextureSelect();

            if (m_noise == null)
            {
                m_noise = new tp_Noise();
                m_noise.Generate(new Point(TerrainData.alphamapWidth, TerrainData.alphamapHeight));
            }
        }
Ejemplo n.º 2
0
        internal override void OnInspectorGUI(TerrainPainter c)
        {
            base.OnInspectorGUI(c);
            GUILayout.BeginHorizontal();
            FlexibleSpace(5);
            component.HeightTool = (HeightTool)GUILayout.Toolbar((int)component.HeightTool, m_toolbarItems, ToolbarOptions(m_toolbarItems.Length));
            FlexibleSpace(5);
            GUILayout.EndHorizontal();

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            switch (c.HeightTool)
            {
            case HeightTool.Sculpt:



                break;

            case HeightTool.Flatten:
                break;

            case HeightTool.Pull:
                break;

            case HeightTool.Erosion:
                break;

            case HeightTool.Smooth:
                break;

            case HeightTool.Clone:
                break;

            case HeightTool.Path:
                break;

            default:
                DrawNone();
                EditorGUILayout.EndVertical();
                return;
            }

            m_noiseResolutionMultiplier = EditorGUILayout.FloatField("noise resolution", m_noiseResolutionMultiplier);


            EditorGUILayout.EndVertical();
            DrawNoiseEditor(component, Mathf.RoundToInt(component.TerrainData.heightmapResolution * m_noiseResolutionMultiplier));
            PaintAllEditor();
        }
Ejemplo n.º 3
0
        internal override void OnInspectorGUI(TerrainPainter c)
        {
            base.OnInspectorGUI(c);
            GUILayout.BeginHorizontal();
            FlexibleSpace(5);
            component.HeightTool = (HeightTool)GUILayout.Toolbar((int)component.HeightTool, m_toolbarItems, ToolbarOptions(m_toolbarItems.Length));
            FlexibleSpace(5);
            GUILayout.EndHorizontal();

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            switch (c.HeightTool)
            {
                case HeightTool.Sculpt:



                    break;
                case HeightTool.Flatten:
                    break;
                case HeightTool.Pull:
                    break;
                case HeightTool.Erosion:
                    break;
                case HeightTool.Smooth:
                    break;
                case HeightTool.Clone:
                    break;
                case HeightTool.Path:
                    break;
                default:
                    DrawNone();
                    EditorGUILayout.EndVertical();
                    return;
            }

            m_noiseResolutionMultiplier = EditorGUILayout.FloatField("noise resolution", m_noiseResolutionMultiplier);


            EditorGUILayout.EndVertical();
            DrawNoiseEditor(component, Mathf.RoundToInt(component.TerrainData.heightmapResolution * m_noiseResolutionMultiplier));
            PaintAllEditor();
        }
Ejemplo n.º 4
0
 internal override void OnSceneGUI(TerrainPainter c)
 {
     base.OnSceneGUI(c);
 }
Ejemplo n.º 5
0
        internal override void OnSceneGUI(TerrainPainter c)
        {
            base.OnSceneGUI(c);

        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initialize component
        /// </summary>
        public void Initialize()
        {
            m_instance = this;

            if (!m_gameObject) { m_gameObject = GetComponent<GameObject>(); }
            if (!m_transform) { m_transform = GetComponent<Transform>(); }

            m_terrain = GetComponent<Terrain>();
            if (Terrain == null) { return; } // { throw new NullReferenceException(Settings.ErrorMessages.NO_TERRAIN_COMPONENT); }

            m_terrainData = m_terrain.terrainData;
            if (TerrainData == null) { return; } // { throw new NullReferenceException(Settings.ErrorMessages.NO_TERRAIN_DATA_COMPONENT); }

            if (m_alpha == null) { m_alpha = new tp_Alpha(); }
            if (m_heights == null) { m_heights = new tp_Heights(); }
            if (m_history == null) { m_history = new tp_History(); }
            if (m_ramp == null) { m_ramp = new tp_MinMax(45.0f, 65.0f); }
            if (m_textures == null) { m_textures = new tp_Textures(); }
            if (m_foliages == null) { m_foliages = new tp_Foliages(); }

            SafeTextureSelect();
            
            if (m_noise == null)
            {
                m_noise = new tp_Noise();
                m_noise.Generate(new Point(TerrainData.alphamapWidth, TerrainData.alphamapHeight));
            }
        }