IsValidTree() private static method

private static IsValidTree ( GameObject tree, int prototypeIndex, Terrain terrain ) : bool
tree UnityEngine.GameObject
prototypeIndex int
terrain UnityEngine.Terrain
return bool
Example #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);
        }
Example #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();
 }
Example #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);
        }