/// <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(FrostProjectile objectToMakeUnused, bool callDestroy)
 {
     if (callDestroy)
     {
         objectToMakeUnused.Destroy();
     }
 }
        public static FrostProjectile CreateNew(Layer layer, float x = 0, float y = 0)
        {
            FrostProjectile instance = null;

            instance = new FrostProjectile(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 <FrostProjectile> )
                {
                    var index = (list as PositionedObjectList <FrostProjectile>).GetFirstAfter(x, Axis.X, 0, list.Count);
                    list.Insert(index, instance);
                }
                else if (SortAxis == FlatRedBall.Math.Axis.Y && list is PositionedObjectList <FrostProjectile> )
                {
                    var index = (list as PositionedObjectList <FrostProjectile>).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);
        }
Exemplo n.º 3
0
    public override void onProjectile(Projectile p)
    {
        base.onProjectile(p);
        FrostProjectile fp = p.gameObject.AddComponent <FrostProjectile>();

        fp.replace(p);
        fp.levelOfFrost = level;
        Destroy(p);
    }
        private static void FactoryInitialize()
        {
            const int numberToPreAllocate = 20;

            for (int i = 0; i < numberToPreAllocate; i++)
            {
                FrostProjectile instance = new FrostProjectile(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(FrostProjectile objectToMakeUnused)
 {
     MakeUnused(objectToMakeUnused, true);
 }