Esempio n. 1
0
        /// <summary>
        /// Updates the loading screen.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                    bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

            // If all the previous screens have finished transitioning
            // off, it is time to actually perform the load.
            if (otherScreensAreGone)
            {
                TankWars.RemoveScreen(this);

                foreach (GameScreen screen in screensToLoad)
                {
                    if (screen != null)
                    {
                        TankWars.AddScreen(screen);
                    }
                }

                // Once the load has finished, we use ResetElapsedTime to tell
                // the  game timing mechanism that we have just finished a very
                // long frame, and that it should not try to catch up.
                TankWars.ResetElapsedTime();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(TankWars.Services, "Content");
            }

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            TankWars.ResetElapsedTime();
        }
Esempio n. 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(TankWars.Services, "Content");
            }

            Content = new Content();
            Content.Font.HUDFont = content.Load <SpriteFont>(@"Fonts\HUDFont");

            // Load tất cả các Textures cần thiết
            Content.Texture.Cursor             = content.Load <Texture2D>(@"Texture\Cursor");
            Content.Texture.Direction          = content.Load <Texture2D>(@"Texture\Direction");
            Content.Texture.TankBot            = content.Load <Texture2D>(@"Texture\TankBot");
            Content.Texture.TankTop            = content.Load <Texture2D>(@"Texture\TankTop");
            Content.Texture.HumveeBot          = content.Load <Texture2D>(@"Texture\HumveeBot");
            Content.Texture.HumveeTop          = content.Load <Texture2D>(@"Texture\HumveeTop");
            Content.Texture.Bullet             = content.Load <Texture2D>(@"Texture\Bullet");
            Content.Texture.Missile            = content.Load <Texture2D>(@"Texture\Missile");
            Content.Texture.SmallLaserRay      = content.Load <Texture2D>(@"Texture\SmallLaserRay");
            Content.Texture.BigLaserRay        = content.Load <Texture2D>(@"Texture\BigLaserRay");
            Content.Texture.MiniMapRectangle   = content.Load <Texture2D>(@"Texture\MiniMapRectangle");
            Content.Texture.Dirt               = content.Load <Texture2D>(@"Texture\Dirt");
            Content.Texture.TileSheet          = content.Load <Texture2D>(@"Texture\TileSheet");
            Content.Texture.PowerSheet         = content.Load <Texture2D>(@"Texture\PowerSheet");
            Content.Texture.BarSheet           = content.Load <Texture2D>(@"Texture\BarSheet");
            Content.Texture.SmallFlameSheet    = content.Load <Texture2D>(@"Texture\SmallFlameSheet");
            Content.Texture.BigFlameSheet      = content.Load <Texture2D>(@"Texture\BigFlameSheet");
            Content.Texture.BulletImpactSheet  = content.Load <Texture2D>(@"Texture\BulletImpactSheet");
            Content.Texture.MissileImpactSheet = content.Load <Texture2D>(@"Texture\MissileImpactSheet");
            Content.Texture.LaserImpactSheet   = content.Load <Texture2D>(@"Texture\LaserImpactSheet");
            Content.Texture.EnergyImpactSheet  = content.Load <Texture2D>(@"Texture\EnergyImpactSheet");
            Content.Texture.ExplosionSheet     = content.Load <Texture2D>(@"Texture\ExplosionSheet");
            Content.Texture.Blank              = content.Load <Texture2D>(@"Texture\Blank");

            // Load tất cả các Sounds cần thiết
            Content.Audio.BulletFiring                       = content.Load <SoundEffect>(@"Audio\BulletFiring");
            Content.Audio.BulletImpact                       = content.Load <SoundEffect>(@"Audio\BulletImpact");
            Content.Audio.MissileFiring                      = content.Load <SoundEffect>(@"Audio\MissileFiring");
            Content.Audio.MissileImpact                      = content.Load <SoundEffect>(@"Audio\MissileImpact");
            Content.Audio.SmallLaserRayFiring                = content.Load <SoundEffect>(@"Audio\SmallLaserRayFiring");
            Content.Audio.SmallLaserRayImpact                = content.Load <SoundEffect>(@"Audio\SmallLaserRayImpact");
            Content.Audio.BigLaserRayFiring                  = content.Load <SoundEffect>(@"Audio\BigLaserRayFiring");
            Content.Audio.BigLaserRayImpact                  = content.Load <SoundEffect>(@"Audio\BigLaserRayImpact");
            Content.Audio.Explosion                          = content.Load <SoundEffect>(@"Audio\Explosion");
            Content.Audio.PowerSwitch                        = content.Load <SoundEffect>(@"Audio\PowerSwitch");
            Content.Audio.TankMove                           = content.Load <SoundEffect>(@"Audio\TankMove");
            Content.Audio.TankMoving                         = Content.Audio.TankMove.CreateInstance();
            Content.Audio.Regenerate                         = content.Load <SoundEffect>(@"Audio\Regenerate");
            Content.Audio.Regenerating                       = Content.Audio.Regenerate.CreateInstance();
            Content.Audio.BackgroundBattlefield              = content.Load <SoundEffect>(@"Audio\BackgroundBattlefield");
            Content.Audio.BackgroundBattlefieldLoop          = Content.Audio.BackgroundBattlefield.CreateInstance();
            Content.Audio.BackgroundBattlefieldLoop.IsLooped = true;
            Content.Audio.BackgroundBattlefieldLoop.Volume   = 0.2f;
            Content.Audio.MissionAccomplish                  = content.Load <SoundEffect>(@"Audio\MissionAccomplish");
            Content.Audio.MissionAccomplished                = Content.Audio.MissionAccomplish.CreateInstance();
            Content.Audio.MissionFail                        = content.Load <SoundEffect>(@"Audio\MissionFail");
            Content.Audio.MissionFailed                      = Content.Audio.MissionFail.CreateInstance();

            Initialize();

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            TankWars.ResetElapsedTime();
        }