コード例 #1
0
ファイル: Game1.cs プロジェクト: CrazeeIvan/Aftermath-2012
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            _mouseBB  = new Rectangle(ms.X, ms.Y, 1, 1);
            _gamefont = Content.Load <SpriteFont>(@"gamefont");

            _hq   = Content.Load <Texture2D>(@"Textures\Sprites\hq");
            _hqBB = new Rectangle((GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - (_hq.Width / 2)), 350, (int)(_hq.Width / 2f), (int)(_hq.Height / 2f));

            _hqShields   = Content.Load <Texture2D>(@"Textures\Sprites\hqShields");
            _hqShieldsBB = new Rectangle(_hqBB.X - 20, _hqBB.Y, (int)(_hqShields.Width), (int)(_hqShields.Height));

            _shieldGen = Content.Load <Texture2D>(@"Textures\Sprites\shieldgen");

            _logo   = Content.Load <Texture2D>(@"Textures\Sprites\aftermathLogo");
            _logoBB = new Rectangle(275, -10, (int)(_logo.Width / 2f), (int)(_logo.Height / 2f));

            _newGame     = Content.Load <Texture2D>(@"Textures\Sprites\NewGame");
            _newGameBB   = new Rectangle(300, 150, (int)(_newGame.Width / 3f), (int)(_newGame.Height / 3f));
            _highscore   = Content.Load <Texture2D>(@"Textures\Sprites\HighScore");
            _highscoreBB = new Rectangle(300, 205, (int)(_highscore.Width / 3f), (int)(_highscore.Height / 3f));
            _exitGame    = Content.Load <Texture2D>(@"Textures\Sprites\Exit");
            _exitGameBB  = new Rectangle(300, 260, (int)(_exitGame.Width / 3f), (int)(_exitGame.Height / 3f));

            _upgrades    = Content.Load <Texture2D>(@"Textures\Sprites\Upgrades");
            _upgradesBB  = new Rectangle(300, 150, (int)(_upgrades.Width / 3f), (int)(_upgrades.Height / 3f));
            _nextWave    = Content.Load <Texture2D>(@"Textures\Sprites\NextWave");
            _nextWaveBB  = new Rectangle(600, 530, (int)(_nextWave.Width / 3f), (int)(_nextWave.Height / 3f));
            _generator   = Content.Load <Texture2D>(@"Textures\Sprites\Generator");
            _generatorBB = new Rectangle(600, 240, (int)(_generator.Width / 3f), (int)(_generator.Height / 3f));
            _shields     = Content.Load <Texture2D>(@"Textures\Sprites\Shields");
            _shieldsBB   = new Rectangle(600, 150, (int)(_shields.Width / 3f), (int)(_shields.Height / 3f));
            _missile     = Content.Load <Texture2D>(@"Textures\Sprites\Missiles");
            _missileBB   = new Rectangle(600, 315, (int)(_missile.Width / 3f), (int)(_missile.Height / 3f));
            _bomb        = Content.Load <Texture2D>(@"Textures\Sprites\Bomb");
            _bombBB      = new Rectangle(600, 420, (int)(_bomb.Width / 3f), (int)(_bomb.Height / 3f));


            _begin   = Content.Load <Texture2D>(@"Textures\Sprites\Begin");
            _beginBB = new Rectangle(300, 205, (int)(_beginBB.Width / 3f), (int)(_beginBB.Height / 3f));


            _resume   = Content.Load <Texture2D>(@"Textures\Sprites\Resume");
            _resumeBB = new Rectangle(300, 205, (int)(_exitGame.Width / 3f), (int)(_exitGame.Height / 3f));

            _shieldGeneratorA    = new ShieldGenerator(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _shieldGen, new Vector2(_hqBB.X - 100, _hqBB.Y + 100));
            _shieldGeneratorB    = new ShieldGenerator(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _shieldGen, new Vector2(_hqBB.X - 200, _hqBB.Y + 100));
            _shieldGeneratorC    = new ShieldGenerator(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _shieldGen, new Vector2(_hqBB.X + (_hq.Width / 2) + 50, _hqBB.Y + 100));
            _shieldGeneratorD    = new ShieldGenerator(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _shieldGen, new Vector2(_hqBB.X + (_hq.Width / 2) + 150, _hqBB.Y + 100));
            _headquarters        = new Hq(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _hq, _hqBB);
            _headquartersShields = new HqShields(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _hqShields, _hqShieldsBB);

            _drawLine = new DrawLine(this, Content, graphics);

            _gameState = new GameStateManager(this);
            _gameState.LoadContent();
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: CrazeeIvan/Aftermath-2012
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            _mouseBB = new Rectangle(ms.X, ms.Y, 1, 1);
            _gamefont = Content.Load<SpriteFont>(@"gamefont");

            _hq = Content.Load<Texture2D>(@"Textures\Sprites\hq");
            _hqBB = new Rectangle((GraphicsDevice.PresentationParameters.BackBufferWidth/2 - (_hq.Width/2)) , 350, (int)(_hq.Width / 2f), (int)(_hq.Height / 2f));

            _hqShields = Content.Load<Texture2D>(@"Textures\Sprites\hqShields");
            _hqShieldsBB = new Rectangle(_hqBB.X -20, _hqBB.Y, (int)(_hqShields.Width), (int)(_hqShields.Height));

            _shieldGen = Content.Load<Texture2D>(@"Textures\Sprites\shieldgen");

            _logo = Content.Load<Texture2D>(@"Textures\Sprites\aftermathLogo");
            _logoBB = new Rectangle(275, -10, (int)(_logo.Width / 2f), (int)(_logo.Height / 2f));

            _newGame = Content.Load<Texture2D>(@"Textures\Sprites\NewGame");
            _newGameBB = new Rectangle(300, 150, (int)(_newGame.Width / 3f), (int)(_newGame.Height / 3f));
            _highscore = Content.Load<Texture2D>(@"Textures\Sprites\HighScore");
            _highscoreBB = new Rectangle(300, 205, (int)(_highscore.Width / 3f), (int)(_highscore.Height / 3f));
            _exitGame = Content.Load<Texture2D>(@"Textures\Sprites\Exit");
            _exitGameBB = new Rectangle(300, 260, (int)(_exitGame.Width / 3f), (int)(_exitGame.Height / 3f));

            _upgrades = Content.Load<Texture2D>(@"Textures\Sprites\Upgrades");
            _upgradesBB = new Rectangle(300, 150, (int)(_upgrades.Width / 3f), (int)(_upgrades.Height / 3f));
            _nextWave = Content.Load<Texture2D>(@"Textures\Sprites\NextWave");
            _nextWaveBB = new Rectangle(600, 530, (int)(_nextWave.Width / 3f), (int)(_nextWave.Height / 3f));
            _generator = Content.Load<Texture2D>(@"Textures\Sprites\Generator");
            _generatorBB = new Rectangle(600, 240, (int)(_generator.Width / 3f), (int)(_generator.Height / 3f));
            _shields = Content.Load<Texture2D>(@"Textures\Sprites\Shields");
            _shieldsBB = new Rectangle(600, 150, (int)(_shields.Width / 3f), (int)(_shields.Height / 3f));
            _missile = Content.Load<Texture2D>(@"Textures\Sprites\Missiles");
            _missileBB = new Rectangle(600, 315, (int)(_missile.Width / 3f), (int)(_missile.Height / 3f));
            _bomb = Content.Load<Texture2D>(@"Textures\Sprites\Bomb");
            _bombBB = new Rectangle(600, 420, (int)(_bomb.Width / 3f), (int)(_bomb.Height / 3f));

            _begin = Content.Load<Texture2D>(@"Textures\Sprites\Begin");
            _beginBB = new Rectangle(300, 205, (int)(_beginBB.Width / 3f), (int)(_beginBB.Height / 3f));

            _resume = Content.Load<Texture2D>(@"Textures\Sprites\Resume");
            _resumeBB = new Rectangle(300, 205, (int)(_exitGame.Width / 3f), (int)(_exitGame.Height / 3f));

            _shieldGeneratorA = new ShieldGenerator(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _shieldGen, new Vector2(_hqBB.X - 100, _hqBB.Y + 100));
            _shieldGeneratorB = new ShieldGenerator(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _shieldGen, new Vector2(_hqBB.X - 200, _hqBB.Y + 100));
            _shieldGeneratorC = new ShieldGenerator(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _shieldGen, new Vector2(_hqBB.X + (_hq.Width / 2) + 50, _hqBB.Y + 100));
            _shieldGeneratorD = new ShieldGenerator(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _shieldGen, new Vector2(_hqBB.X + (_hq.Width / 2) + 150, _hqBB.Y + 100));
            _headquarters = new Hq(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _hq, _hqBB);
            _headquartersShields = new HqShields(this, spriteBatch, graphics.GraphicsDevice.Viewport.TitleSafeArea, _hqShields, _hqShieldsBB);

            _drawLine = new DrawLine(this, Content, graphics);

            _gameState = new GameStateManager(this);
            _gameState.LoadContent();
        }