Ejemplo n.º 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //Initialize blank particle texture as a single pixel
            ParticleGenerator.ParticleTexture = new Texture2D(GraphicsDevice, 1, 1);
            ParticleGenerator.ParticleTexture.SetData <Color>(new Color[] { Color.White });

            //load hud textures
            //SpaceGame.graphics.hud.RadialBar.BarPipTexture = Content.Load<Texture2D>("hud/radial_bar_pip");
            SpaceGame.graphics.hud.RadialBar.GameGraphicsDevice = GraphicsDevice;

            //Load GUI textures
            SpaceGame.graphics.hud.GUI.targetWheel = Content.Load <Texture2D>("gui/Minimap_&_Health_Bar_00");
            SpaceGame.graphics.hud.GUI.leftClick   = Content.Load <Texture2D>("gui/Left Click");
            SpaceGame.graphics.hud.GUI.rightClick  = Content.Load <Texture2D>("gui/Right Click");
            SpaceGame.graphics.hud.GUI.spaceClick  = Content.Load <Texture2D>("gui/Space Bar");
            SpaceGame.graphics.hud.GUI.shiftClick  = Content.Load <Texture2D>("gui/Shift");
            SpaceGame.graphics.hud.GUI.button1     = Content.Load <Texture2D>("gui/Numer 1");
            SpaceGame.graphics.hud.GUI.button3     = Content.Load <Texture2D>("gui/Numer 3");
            SpaceGame.graphics.hud.GUI.button5     = Content.Load <Texture2D>("gui/Numer 5");
            SpaceGame.graphics.hud.GUI.button2     = Content.Load <Texture2D>("gui/Numer 2");
            SpaceGame.graphics.hud.GUI.button4     = Content.Load <Texture2D>("gui/Numer 4");
            SpaceGame.graphics.hud.GUI.button6     = Content.Load <Texture2D>("gui/Numer 6");
            SpaceGame.graphics.hud.GUI.voidWheel   = Content.Load <Texture2D>("gui/Score_&_Void_Tracker");

            Sprite.IceCubeTexture = Content.Load <Texture2D>("spritesheets/IceCube");

            XnaHelper.PixelTexture = new Texture2D(GraphicsDevice, 1, 1);
            XnaHelper.PixelTexture.SetData <Color>(new Color[] { Color.White });

            Sprite.Content            = Content; //Sprite gets reference to content so it can load textures
            ParticleGenerator.Content = Content; //ParticleGenerator gets reference to content so it can load textures

            //load data from xml
            ParticleGenerator.Data = DataLoader.CollectData <ParticleGeneratorData>(
                DataLoader.PARTICLE_EFFECT_PATH, "ParticleGeneratorData").ToDictionary(t => t.Name);

            ParticleEffect.Data = DataLoader.LoadParticleEffectData(Content);

            Sprite.Data = DataLoader.CollectData <SpriteData>(
                DataLoader.SPRITE_PATH, "SpriteData").ToDictionary(t => t.Name);

            ProjectileWeapon.DataDict = DataLoader.CollectData <ProjectileWeaponData>(
                DataLoader.WEAPON_DATA_PATH, "ProjectileWeapon").ToDictionary(t => t.Name);

            MeleeWeapon.MeleeWeaponDataDict = DataLoader.CollectData <MeleeWeapon.MeleeWeaponData>(
                DataLoader.WEAPON_DATA_PATH, "MeleeWeapon").ToDictionary(t => t.Name);

            Spaceman.AstronautData = DataLoader.CollectData <PhysicalData>(
                DataLoader.UNIT_DATA_PATH, "AstronautData").Single <PhysicalData>();

            FoodCart.Data = DataLoader.CollectData <PhysicalData>(
                DataLoader.UNIT_DATA_PATH, "FoodCartData").Single <PhysicalData>();

            Enemy.EnemyDataDict = DataLoader.CollectData <EnemyData>(
                DataLoader.UNIT_DATA_PATH, "EnemyData").ToDictionary(t => t.Name);

            Gadget.GadgetDataDict = DataLoader.CollectData <GadgetData>(
                DataLoader.GADGET_DATA_PATH, "GadgetData").ToDictionary(t => t.Name);

            Gamemenu.LoadContent(Content);
            _stateStack.Add(new Gamemenu());
        }