ChangeShaderOnMaterials() private static method

private static ChangeShaderOnMaterials ( TreeData treeData, Shader shader, TreeGroup group, NodeType nodeType ) : void
treeData TreeData
shader UnityEngine.Shader
group TreeGroup
nodeType NodeType
return void
Esempio n. 1
0
 private static void ChangeShaderOnMaterials(TreeData treeData, Shader shader, TreeGroup group, TreeEditorHelper.NodeType nodeType)
 {
     if (group is TreeGroupBranch && nodeType == TreeEditorHelper.NodeType.BarkNode)
     {
         TreeGroupBranch treeGroupBranch = group as TreeGroupBranch;
         TreeEditorHelper.ChangeShaderOnMaterial(treeGroupBranch.materialBranch, shader);
         TreeEditorHelper.ChangeShaderOnMaterial(treeGroupBranch.materialBreak, shader);
         TreeEditorHelper.ChangeShaderOnMaterial(treeGroupBranch.materialFrond, shader);
     }
     else
     {
         if (group is TreeGroupLeaf && nodeType == TreeEditorHelper.NodeType.LeafNode)
         {
             TreeGroupLeaf treeGroupLeaf = group as TreeGroupLeaf;
             TreeEditorHelper.ChangeShaderOnMaterial(treeGroupLeaf.materialLeaf, shader);
         }
     }
     int[] childGroupIDs = group.childGroupIDs;
     for (int i = 0; i < childGroupIDs.Length; i++)
     {
         int       id     = childGroupIDs[i];
         TreeGroup group2 = treeData.GetGroup(id);
         TreeEditorHelper.ChangeShaderOnMaterials(treeData, shader, group2, nodeType);
     }
 }
Esempio n. 2
0
        private bool GUITooManyShaders(TreeEditorHelper.NodeType nodeType)
        {
            string text = nodeType.ToString();

            if (this.CheckForTooManyShaders(nodeType))
            {
                this.SetAnimBool(text, true, true);
            }
            List <string> shadersListForNodeType = this.GetShadersListForNodeType(nodeType);
            GUIContent    gUIContent             = TreeEditorHelper.GetGUIContent((nodeType != TreeEditorHelper.NodeType.BarkNode) ? "TreeEditor.TreeGroup.TooManyLeafShaders" : "TreeEditor.TreeGroup.TooManyBarkShaders");
            GUIContent    gUIContent2            = TreeEditorHelper.GetGUIContent("TreeEditor.TreeGroup.ChangeAllShadersOnNodesButton");
            int           num = this.GUIShowError(text, shadersListForNodeType, gUIContent, gUIContent2, ConsoleWindow.iconError);

            if (num >= 0)
            {
                Shader shader = Shader.Find(shadersListForNodeType[num]);
                TreeEditorHelper.ChangeShaderOnMaterials(this.m_TreeData, shader, this.m_TreeData.root, nodeType);
                this.DisableAnimBool(text);
                this.RemoveSelectedIndex(text);
                return(true);
            }
            return(false);
        }