Example #1
0
        ///////////////////////////////////////////////////////
        //
        // Private Methods
        //
        ///////////////////////////////////////////////////////



        ///////////////////////////////////////////////////////
        //
        // Contracts
        //
        ///////////////////////////////////////////////////////

        protected override void FillReserve(int fillSize)
        {
            for (int i = fillSize; i > 0; i--)
            {
                SpriteCollisionProxy newNode = new SpriteCollisionProxy();
                this.reservedList.PushFront(newNode);
            }
        }
Example #2
0
        /// <summary>
        ///		Removes the flyweight sprite to be used again from the pool
        /// </summary>
        /// <param name="name"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool Recycle(Sprite.Name name, uint id)
        {
            Debug.Assert(name != Sprite.Name.UNINITIALIZED);
            //Debug.Assert(name != Sprite.Name.NULL);

            SpriteCollisionProxy oldProxy = this.BaseRecycle(name, id) as SpriteCollisionProxy;

            if (oldProxy == null)
            {
                return(false);
            }
            oldProxy.Reset();
            return(true);
        }
Example #3
0
        ///////////////////////////////////////////////////////
        //
        // Methods
        //
        ///////////////////////////////////////////////////////

        /// <summary>
        ///		Create a new flyweight sprite referencing a model SpriteCollision
        /// </summary>
        /// <param name="spriteName"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public SpriteCollisionProxy Create(Sprite.Name spriteName, uint id)
        {
            Debug.Assert(spriteName != Sprite.Name.UNINITIALIZED);
            //Debug.Assert(spriteName != Sprite.Name.NULL);

            SpriteCollision modelSprite = SpriteCollisionManager.Self.Find(spriteName);

            Debug.Assert(modelSprite != null, "For some reason, the model collision sprite could not be found!");
            SpriteCollisionProxy newProxy = this.BaseCreate(id) as SpriteCollisionProxy;

            newProxy.SetName(spriteName);
            newProxy.SetModelSprite(modelSprite);
            return(newProxy);
        }