Ejemplo n.º 1
0
        public GameObject SpawnFuel(float positionX, float positionY)
        {
            int type = (int)PyroGameObjectTypes.Fuel;

            GameObject result = mGameObjectPool.Allocate();

            result.SetPosition(positionX, positionY);
            result.ActivationRadius      = mActivationRadiusTight;
            result.width                 = 32;
            result.height                = 32;
            result.PositionLocked        = true;
            result.DestroyOnDeactivation = false;

            result.life = 1;
            result.team = GameObject.Team.NONE;

            FixedSizeArray <BaseObject> staticData = GetStaticData(type);

            if (staticData == null)
            {
                ContentManager content = sSystemRegistry.Game.Content;
                GraphicsDevice device  = sSystemRegistry.Game.GraphicsDevice;

                int staticObjectCount = 1;
                staticData = new FixedSizeArray <BaseObject>(staticObjectCount);

                const int fileImageSize = 64;
                Rectangle crop          = new Rectangle(0, 0, fileImageSize, fileImageSize);
                Texture2D texture       = content.Load <Texture2D>(@"pics\fuel");


                DrawableTexture2D textureDrawable = new DrawableTexture2D(texture, (int)result.width, (int)result.height);
                textureDrawable.SetCrop(crop);

                RenderComponent render = (RenderComponent)AllocateComponent(typeof(RenderComponent));
                render.Priority = PyroSortConstants.FUEL;
                render.setDrawable(textureDrawable);

                staticData.Add(render);
                SetStaticData(type, staticData);
            }

            LifetimeComponent lifetime = AllocateComponent <LifetimeComponent>();

            lifetime.SetDeathSound(fuelSound);

            result.Add(lifetime);

            AddStaticData(type, result, null);

            return(result);
        }
Ejemplo n.º 2
0
        public GameObject SpawnBackgroundPlate(float positionX, float positionY)
        {
            const int  width  = 1280;
            const int  height = 720;
            int        type   = (int)PyroGameObjectTypes.Background_Plate;
            GameObject result = mGameObjectPool.Allocate();

            result.SetPosition(positionX, positionY);
            result.ActivationRadius = mActivationRadiusExtraWide;
            result.width            = width;
            result.height           = height;

            ContentManager content = sSystemRegistry.Game.Content;

            FixedSizeArray <BaseObject> staticData = GetStaticData(type);

            if (staticData == null)
            {
                const int staticObjectCount = 1;
                staticData = new FixedSizeArray <BaseObject>(staticObjectCount);

                //InventoryRecord addWin = new InventoryRecord();
                //addWin.winCount = 1;

                //staticData.Add(addWin);

                SetStaticData(type, staticData);
            }

            Rectangle         crop            = new Rectangle(0, 0, width, height);
            DrawableTexture2D textureDrawable = new DrawableTexture2D(content.Load <Texture2D>(@"pics\background"), (int)result.width, (int)result.height);

            textureDrawable.SetCrop(crop);

            RenderComponent render = (RenderComponent)AllocateComponent(typeof(RenderComponent));

            render.Priority = PyroSortConstants.BACKGROUND;
            render.setDrawable(textureDrawable);


            result.Add(render);

            //AddStaticData(type, result, null);

            return(result);
        }