private static void FactoryInitialize() { const int numberToPreAllocate = 20; for (int i = 0; i < numberToPreAllocate; i++) { Rock instance = new Rock(mContentManagerName, false); mPool.AddToPool(instance); } }
public static Rock CreateNew(Layer layer) { if (string.IsNullOrEmpty(mContentManagerName)) { throw new System.Exception("You must first initialize the factory to use it."); } Rock instance = null; instance = new Rock(mContentManagerName, false); instance.AddToManagers(layer); if (mScreenListReference != null) { mScreenListReference.Add(instance); } if (EntitySpawned != null) { EntitySpawned(instance); } return instance; }
public static void MakeUnused(Rock objectToMakeUnused, bool callDestroy) { objectToMakeUnused.Destroy(); }
public static void MakeUnused(Rock objectToMakeUnused) { MakeUnused(objectToMakeUnused, true); }