Exemplo 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()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //initialize helper pixel texture for debugging
            XnaHelper.PixelTexture = new Texture2D(GraphicsDevice, 1, 1);
            XnaHelper.PixelTexture.SetData<Color>(new Color[] { Color.White });
            XnaHelper.Font = Content.Load<SpriteFont>("Fonts/standard_font");
            SpriteFont Font1 = Content.Load<SpriteFont>("Fonts/TitleFont");
            Texture2D sprite = Content.Load<Texture2D>("spritesheets/Gino");

            //needed for level to load and draw maps
            Level.MapDisplayDevice = new xTile.Display.XnaDisplayDevice(this.Content, this.GraphicsDevice);
            //give Level ref to Content so they can load data
            Level.Content = this.Content;
            Level.outDoorTexture = Content.Load<Texture2D>("out-door");

            //initialize unit data
            Unit.UnitDataDict = DataLoader.LoadUnitData();
            //initialize sprite data
            Sprite.SpriteDataDict = DataLoader.LoadSpriteData();
            //initialize weapon data
            Weapon.Data = DataLoader.LoadWeaponData();
            Overworld.Nodes = DataLoader.LoadOverworldData();
            OverworldView.LoadTextures(Content.Load<Texture2D>("Icons/Node"), Content.Load<Texture2D>("Backgrounds/OverworldMap"));
            SpriteView.LoadTextures(Sprite.SpriteDataDict.Keys.ToArray<string>(), Content);
            InstructionScreen.LoadTextures(Content.Load<Texture2D>("Backgrounds/Intructions"));

            MainMenuView.LoadTextures(Content.Load<Texture2D>("Backgrounds/MainMenu"));
            Texture2D spritem = Content.Load<Texture2D>("spritesheets/MainMenuSprite");
            //Instructions.LoadTextures(Content.Load<Texture2D>("Backgrounds/Instructions"));
            Shop.LoadMouse(Content.Load<Texture2D>("Icons/node"));
            ShopView.LoadFont(Content.Load<SpriteFont>("Fonts/TitleFont"));
            ShopView.LoadTextures(Content.Load<Texture2D>("Backgrounds/ShopInterface"));
            ShopView.LoadGuns(Content.Load<Texture2D>("spritesheets/Revolver"),
                Content.Load<Texture2D>("spritesheets/Rifle"),
                Content.Load<Texture2D>("spritesheets/Shotgun"),
                Content.Load<Texture2D>("spritesheets/MachinePistol"));
            ShopView.LoadGray(Content.Load<Texture2D>("Icons/revolverGray"),
                Content.Load<Texture2D>("Icons/rifleGray"),
                Content.Load<Texture2D>("Icons/shotgunGray"),
                Content.Load<Texture2D>("Icons/uziGray"),
                Content.Load<Texture2D>("Icons/fedoraGray"));
            ShopView.LoadArmor(Content.Load<Texture2D>("spritesheets/fedora"));

            //Later: change this in main menu
            //initialize new data if select new game
            //load data if select continue game

            _currentState = new MainMenu(GraphicsDevice, Font1, spritem);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            //make sure to update inputmanager, otherwise player input will not be detected
            _input.Update();

            // Allows the game to exit
            if (_currentState.RequestExit)
                this.Exit();

            if (_currentState.NewState != null)     //new state requested
                _currentState = _currentState.NewState;

            _currentState.Update(gameTime, _input);
            //SoundPlayer.Update();

            base.Update(gameTime);
        }
Exemplo n.º 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //initialize helper pixel texture for debugging
            XnaHelper.PixelTexture = new Texture2D(GraphicsDevice, 1, 1);
            XnaHelper.PixelTexture.SetData<Color>(new Color[] {Color.White});

            //needed for level to load and draw maps
            Level.MapDisplayDevice = new xTile.Display.XnaDisplayDevice(this.Content, this.GraphicsDevice);
            //give Level ref to Content so they can load data
            Level.Content = this.Content;

            //initialize unit data
            Unit.UnitDataDict = DataLoader.LoadUnitData();
            //initialize sprite data
            Sprite.SpriteDataDict = DataLoader.LoadSpriteData();
            SpriteView.LoadTextures(Sprite.SpriteDataDict.Keys.ToArray<string>(), Content);

            _currentState = new Level(0);
        }