Last active
August 31, 2019 14:09
-
-
Save JoseMiguelPizarro/25745817a175626bb414f80875c9f100 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System; | |
public static class LevelMeshToolProvider | |
{ | |
public static List<LevelMeshTool> tools = new List<LevelMeshTool>(); | |
static LevelMeshToolProvider() | |
{ | |
foreach (var type in GetAllTypes(AppDomain.CurrentDomain)) | |
{ | |
if (type.IsSubclassOf(typeof(LevelMeshTool))) | |
{ | |
var t = Activator.CreateInstance(type) as LevelMeshTool; | |
tools.Add(t); | |
} | |
} | |
} | |
private static IEnumerable<Type> GetAllTypes(AppDomain domain) | |
{ | |
foreach (var assembly in domain.GetAssemblies()) | |
{ | |
Type[] types = assembly.GetTypes(); | |
foreach (var type in types) | |
{ | |
yield return type; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment