private static IsValidTree ( |
||
tree | ||
prototypeIndex | int | |
terrain | ||
Результат | bool |
private static bool IsValidTree(GameObject tree, int prototypeIndex, Terrain terrain)
{
if (tree == null)
{
return false;
}
TreePrototype[] treePrototypes = terrain.terrainData.treePrototypes;
for (int i = 0; i < treePrototypes.Length; i++)
{
if ((i != prototypeIndex) && (treePrototypes[i].m_Prefab == tree))
{
return false;
}
}
return true;
}
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); }