/// <summary> /// Makes the argument objectToMakeUnused marked as unused. This method is generated to be used /// by generated code. Use Destroy instead when writing custom code so that your code will behave /// the same whether your Entity is pooled or not. /// </summary> public static void MakeUnused(A_Brick objectToMakeUnused, bool callDestroy) { if (callDestroy) { objectToMakeUnused.Destroy(); } }
public static A_Brick CreateNew(Layer layer, float x = 0, float y = 0) { A_Brick instance = null; instance = new A_Brick(mContentManagerName ?? FlatRedBall.Screens.ScreenManager.CurrentScreen.ContentManagerName, false); instance.AddToManagers(layer); instance.X = x; instance.Y = y; foreach (var list in ListsToAddTo) { if (SortAxis == FlatRedBall.Math.Axis.X && list is PositionedObjectList <A_Brick> ) { var index = (list as PositionedObjectList <A_Brick>).GetFirstAfter(x, Axis.X, 0, list.Count); list.Insert(index, instance); } else if (SortAxis == FlatRedBall.Math.Axis.Y && list is PositionedObjectList <A_Brick> ) { var index = (list as PositionedObjectList <A_Brick>).GetFirstAfter(y, Axis.Y, 0, list.Count); list.Insert(index, instance); } else { // Sort Z not supported list.Add(instance); } } if (EntitySpawned != null) { EntitySpawned(instance); } return(instance); }
private static void FactoryInitialize() { const int numberToPreAllocate = 20; for (int i = 0; i < numberToPreAllocate; i++) { A_Brick instance = new A_Brick(mContentManagerName, false); mPool.AddToPool(instance); } }
/// <summary> /// Makes the argument objectToMakeUnused marked as unused. This method is generated to be used /// by generated code. Use Destroy instead when writing custom code so that your code will behave /// the same whether your Entity is pooled or not. /// </summary> public static void MakeUnused(A_Brick objectToMakeUnused) { MakeUnused(objectToMakeUnused, true); }