public void RemoveModule(ISCModule Module) { if (Module == null) { return; } DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "Module '" + Module.GetType() + "' [HashCode: " + Module.GetHashCode() + "] Remove From Module '" + GetType(), this); lock (subModuleList) { subModuleList.Remove(Module); } Module.ModuleDestroy(); Module.FatherModule = null; }
/// <summary> /// ModuleDestroy =================================== /// </summary> public void AddModule(ISCModule Module, bool isEffectGameObject = true, SCModulePriority priority = SCModulePriority.Middle) { if (Module == null) { return; } Module.FatherModule = this; Module.ModuleInit(isEffectGameObject, priority); DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "Module '" + Module.GetType() + "' [HashCode: " + Module.GetHashCode() + "] Add To Module '" + GetType(), this); lock (subModuleList) { subModuleList.Add(Module); } }
public T Transition <T>(ISCModule data) where T : class { if ((data as T) == null) { throw new ArgumentException(String.Format("Invalid type: {0} passed to event expecting {1}", data.GetType(), typeof(T))); } return(data as T); }