private bool FirePlugin(Type type, int level) { SpaceAddonMonoBehaviour atr = AttributeUtils.GetTypeAttribute <SpaceAddonMonoBehaviour>(type); if (atr != null) { if ((int)atr.EntryPoint == level) { GameObject go = new GameObject(type.Name); go.transform.position = Vector3.zero; go.transform.rotation = Quaternion.identity; go.AddComponent(type); return(true); } } return(false); }
public List <T> GetAllSubclassesOf <T, U, Y>(Assembly assembly) where T : Type where U : Attribute { Type[] types = assembly.GetTypes(); List <T> output = new List <T>(); foreach (Type type in types) { if (type.IsSubclassOf(typeof(Y))) { U atr = AttributeUtils.GetTypeAttribute <U>(type); if (atr != null) { output.Add(type as T); } } } return(output); }
private bool FirePlugin(Type type) { int currentScene = SceneManager.GetActiveScene().buildIndex; SpaceAddonMonoBehaviour atr = AttributeUtils.GetTypeAttribute <SpaceAddonMonoBehaviour>(type); if (atr != null) { if ((int)atr.EntryPoint == currentScene) { GameObject go = new GameObject(type.Name); go.transform.position = Vector3.zero; go.transform.rotation = Quaternion.identity; go.AddComponent(type); return(true); } } return(false); }