public void FindBrushes()
 {
     brushTypes = new List <Type>();
     foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
     {
         foreach (Type t in a.GetTypes())
         {
             BrushAttribute att = (BrushAttribute)t.GetCustomAttribute(typeof(BrushAttribute));
             if (att != null)
             {
                 brushTypes.Add(t);
             }
         }
     }
     currentBrush     = new AddBrush();
     currentBrushName = "Add";
 }
Esempio n. 2
0
        private void Awake()
        {
            t = target as MarchingTerrain;
            t.FindBrushes();
            brushMenu = new GenericMenu();
            foreach (Type bt in t.brushTypes)
            {
                BrushAttribute att = (BrushAttribute)bt.GetCustomAttribute(typeof(BrushAttribute));
                brushMenu.AddItem(new GUIContent(att.path), false, () => {
                    t.currentBrush     = (Brush)Activator.CreateInstance(bt);
                    t.currentBrushName = att.name;
                });
            }

            if (t.data == null)
            {
                InitData();
            }

            t.FindOthers();
        }