public static void Load(this CommandSimulaterComponent self) { self.commandSimulaters = new Dictionary <Type, ICommandSimulater>(); foreach (Type type in typeof(CommandSimulaterComponentSystem).Assembly.GetTypes()) { object[] objects = type.GetCustomAttributes(typeof(CommandInputAttribute), false); if (objects.Length == 0) { continue; } CommandInputAttribute commandInputAttr = (CommandInputAttribute)objects[0]; ICommandSimulater simulater = Activator.CreateInstance(type) as ICommandSimulater; self.commandSimulaters.Add(commandInputAttr.Type, simulater); } }
public static void Awake(this CommandSimulaterComponent self) { self.Load(); }