Inheritance: UnityEditor.TerrainWizard
コード例 #1
0
        protected override bool DrawWizardGUI()
        {
            EditorGUI.BeginChangeCheck();
            this.m_Tree = (GameObject)EditorGUILayout.ObjectField("Tree Prefab", (Object)this.m_Tree, typeof(GameObject), !EditorUtility.IsPersistent((Object)this.m_Terrain.terrainData), new GUILayoutOption[0]);
            if (!TerrainEditorUtility.IsLODTreePrototype(this.m_Tree))
            {
                this.m_BendFactor = EditorGUILayout.FloatField("Bend Factor", this.m_BendFactor, new GUILayoutOption[0]);
            }
            bool flag = EditorGUI.EndChangeCheck();

            if (flag)
            {
                this.m_IsValidTree = TreeWizard.IsValidTree(this.m_Tree, this.m_PrototypeIndex, this.m_Terrain);
            }
            return(flag);
        }
コード例 #2
0
 internal void InitializeDefaults(Terrain terrain, int index)
 {
     this.m_Terrain        = terrain;
     this.m_PrototypeIndex = index;
     if (this.m_PrototypeIndex == -1)
     {
         this.m_Tree       = null;
         this.m_BendFactor = 0f;
     }
     else
     {
         this.m_Tree       = this.m_Terrain.terrainData.treePrototypes[this.m_PrototypeIndex].prefab;
         this.m_BendFactor = this.m_Terrain.terrainData.treePrototypes[this.m_PrototypeIndex].bendFactor;
     }
     this.m_IsValidTree = TreeWizard.IsValidTree(this.m_Tree, this.m_PrototypeIndex, terrain);
     this.OnWizardUpdate();
 }
コード例 #3
0
        protected override bool DrawWizardGUI()
        {
            EditorGUI.BeginChangeCheck();
            this.m_Tree = (GameObject)EditorGUILayout.ObjectField("Tree Prefab", this.m_Tree, typeof(GameObject), false, new GUILayoutOption[0]);
            bool flag = this.m_Tree != null && this.m_Tree.GetComponent <LODGroup>() == null;

            if (flag)
            {
                this.m_BendFactor = EditorGUILayout.FloatField("Bend Factor", this.m_BendFactor, new GUILayoutOption[0]);
            }
            bool flag2 = EditorGUI.EndChangeCheck();

            if (flag2)
            {
                this.m_IsValidTree = TreeWizard.IsValidTree(this.m_Tree, this.m_PrototypeIndex, this.m_Terrain);
            }
            return(flag2);
        }
コード例 #4
0
        static internal void EditTree(MenuCommand item)
        {
            TreeWizard wizard = TerrainWizard.DisplayTerrainWizard <TreeWizard>("Edit Tree", "Apply");

            wizard.InitializeDefaults((Terrain)item.context, item.userData);
        }
コード例 #5
0
        static internal void AddTree(MenuCommand item)
        {
            TreeWizard wizard = TerrainWizard.DisplayTerrainWizard <TreeWizard>("Add Tree", "Add");

            wizard.InitializeDefaults((Terrain)item.context, -1);
        }
コード例 #6
0
        internal static void AddTree(MenuCommand item)
        {
            TreeWizard treeWizard = ScriptableWizard.DisplayWizard <TreeWizard>("Add Tree", "Add");

            treeWizard.InitializeDefaults((Terrain)item.context, -1);
        }
コード例 #7
0
        internal static void EditTree(MenuCommand item)
        {
            TreeWizard treeWizard = ScriptableWizard.DisplayWizard <TreeWizard>("Edit Tree", "Apply");

            treeWizard.InitializeDefaults((Terrain)item.context, item.userData);
        }