コード例 #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));
            }
        }
コード例 #2
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));
            }
        }