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