Exemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public MenuScreen(string menuTitle)
        {
            this.menuTitle = menuTitle;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            menuUp = new InputAction(
                new Buttons[] { Buttons.DPadUp, Buttons.LeftThumbstickUp },
                new Keys[] { Keys.Up },
                true);
            menuDown = new InputAction(
                new Buttons[] { Buttons.DPadDown, Buttons.LeftThumbstickDown },
                new Keys[] { Keys.Down },
                true);
            menuSelect = new InputAction(
                new Buttons[] { Buttons.A },
                new Keys[] { Keys.Enter },
                true);
            menuCancel = new InputAction(
                new Buttons[] { Buttons.B },
                new Keys[] { Keys.Escape },
                true);

            camera = new ChasingCamera2D();
            camera2 = new ChasingCamera2D();
            camera.maxChaseSpeed = 1200;
            //camera.Pos = new Vector2(1920 / 2, 1080 / 2);
            camera2.maxChaseSpeed = 1200;
            //camera2.Pos = new Vector2(1920 / 2, 1080 / 2);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public PressStartScreen(Cue bgm)
        {
            this.bgm = bgm;
            TransitionOnTime = TimeSpan.FromSeconds(1);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            pressStartAction = new InputAction(
                new Buttons[] { Buttons.Start, Buttons.A },
                new Keys[] { Keys.Enter },
                true);

            mirrorCamera = new ChasingCamera2D();
            mirrorCamera.Pos = new Vector2(GlobalHelper.GameWidth / 2, GlobalHelper.GameHeight / 2);
            //mirrorCamera.maxChaseSpeed *= 4;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "main");

                // Start the action background music FIRST
                actionBgm = ((GameMain)ScreenManager.Game).AudioEM.GetCue("actionBg1");
                actionBgm.Play();

                // LOAD FONTS & BLANK TEXTURE
                debugFont = content.Load<SpriteFont>(@"fonts\debug");
                gameFont = content.Load<SpriteFont>(@"fonts\game1");
                blank = content.Load<Texture2D>(@"textures\blank");

                // LOAD SOUNDS
                AudioEngine audioEngine = ((GameMain)ScreenManager.Game).AudioEM.AudioEngine;
                weaponWaves = new WaveBank(audioEngine, @"main\audio\weaponWaves.xwb");
                weaponSounds = new SoundBank(audioEngine, @"main\audio\weaponSounds.xsb");

                // LOAD WEAPONS
                Texture2D bulletPath1 = content.Load<Texture2D>(@"textures\weapons\bulletPath1");
                Texture2D bulletPath2 = content.Load<Texture2D>(@"textures\weapons\bulletPath2");
                lazerTexture = content.Load<Texture2D>(@"textures\weapons\lazer");
                crosshairTexture = content.Load<Texture2D>(@"textures\weapons\crosshair");

                // LOAD VEHICLES
                bobcatTexture = content.Load<Texture2D>(@"textures\vehicles\pickup_nfw");
                bobcatWheelsTexture = content.Load<Texture2D>(@"textures\vehicles\pickup_w");

                // LOAD PED SPRITE TEXTURES
                cowboySheetTexture = content.Load<Texture2D>(@"textures\peds\cowboy1");
                zombieSheetTexture = content.Load<Texture2D>(@"textures\peds\zombie1");
                zombieSheetTexture2 = content.Load<Texture2D>(@"textures\peds\zombie2");
                evilCowboySheetTexture = content.Load<Texture2D>(@"textures\peds\zombiecowboy");

                // LOAD PARTICLE EFFECTS
                particleRenderer = new SpriteBatchRenderer { GraphicsDeviceService = (IGraphicsDeviceService)ScreenManager.Game.Services.GetService(typeof(IGraphicsDeviceService)), };
                particleRenderer.LoadContent(content);
                ParticleEffect bloodBlastEffect = content.Load<ParticleEffect>(@"particles\bloodSplit1");
                ParticleEffect deathBlastEffect = content.Load<ParticleEffect>(@"particles\deathBlast1");
                ParticleEffect powerUpBlastEffect = content.Load<ParticleEffect>(@"particles\powerUpBlast");
                bloodBlastEffect.LoadContent(content); bloodBlastEffect.Initialise();
                deathBlastEffect.LoadContent(content); deathBlastEffect.Initialise();
                powerUpBlastEffect.LoadContent(content); powerUpBlastEffect.Initialise();

                // LOAD MAP TEXTURES
                Vector2 worldSize = new Vector2(4000, 3000);
                Texture2D tileBackgroundTexture = content.Load<Texture2D>(@"textures\map\map" + random.Next(2).ToString());
                Texture2D healthPowerUpTexture = content.Load<Texture2D>(@"textures\powerups\health");
                Texture2D ammoPowerUpTexture = content.Load<Texture2D>(@"textures\powerups\ammo");
                Texture2D moneyPowerUpTexture = content.Load<Texture2D>(@"textures\powerups\money");
                Texture2D revivePowerUpTexture = content.Load<Texture2D>(@"textures\powerups\revive");
                Texture2D shieldPowerUpTexture = content.Load<Texture2D>(@"textures\powerups\shield");
                Texture2D weaponShop = content.Load<Texture2D>(@"textures\map\weaponShop");
                Texture2D modShop = content.Load<Texture2D>(@"textures\map\modShop");

                // Construct world
                world = new World(ScreenManager.Game, worldSize, tileBackgroundTexture, new Texture2D[] { bulletPath1, bulletPath2 }, new Texture2D[] { healthPowerUpTexture, ammoPowerUpTexture, moneyPowerUpTexture, revivePowerUpTexture, shieldPowerUpTexture }, new Texture2D[] { weaponShop, modShop }, weaponSounds, new ParticleEffect[] { bloodBlastEffect, deathBlastEffect, powerUpBlastEffect });

                // Construct Essential Peds
                cowboy = new Cowboy(new Vector2(1000, 1000), new Vector2(0, -1), cowboySheetTexture, world);

                // give guns to player cowboy
                cowboy.GetGun(new M1911(cowboy, world));
                world.playerList.Add(cowboy);
                cowboy.AddMoney(90);
                world.LoadPresetMap(0, blank); // LOADS PRESET DEBUG MAP
                p1Cam = new ChasingCamera2D();
                p1Cam.maxChaseSpeed = 1200;
                inputC = new InputState();

                // LOAD HUD & ITS ELEMENTS (MUST BE DONE LAST!)
                Texture2D barTexture = content.Load<Texture2D>(@"textures\hud\healthBar");
                Texture2D hudM1911 = content.Load<Texture2D>(@"textures\hud\m1911");
                Texture2D hudAk74u = content.Load<Texture2D>(@"textures\hud\ak74u");
                Texture2D hudM4a1 = content.Load<Texture2D>(@"textures\hud\m4a1");
                Texture2D hudR870mcs = content.Load<Texture2D>(@"textures\hud\r870mcs");
                Texture2D hudM60 = content.Load<Texture2D>(@"textures\hud\m60");
                Texture2D screenBlood = content.Load<Texture2D>(@"textures\hud\screenBlood");
                SpriteFont hudFont = content.Load<SpriteFont>(@"fonts\hud");
                statusDisplay = new StatusDisplay(cowboy, new Vector2(500, 108), barTexture, blank, new Texture2D[] { hudM1911, hudAk74u, hudM4a1, hudR870mcs, hudM60 }, screenBlood, hudFont);

            #if XBOX

            #else
                FAZEngine.ScriptEngine.ScriptLoader.LoadModScripts(this);
            #endif

                // 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.
                ScreenManager.Game.ResetElapsedTime();
            }
        }
Exemplo n.º 4
0
        public void Update(GameTime gameTime, ChasingCamera2D cam)
        {
            bool shakeit = true;
            lastHealth = health;
            lastMaxHealth = maxHealth;
            lastInCar = inCar;

            inCar = boundedPlayer.CarDriving != null;

            if (!inCar)
            {
                health = boundedPlayer.Health;
                maxHealth = boundedPlayer.MaxHealth;
            }
            else
            {
                health = boundedPlayer.CarDriving.Health;
                maxHealth = boundedPlayer.CarDriving.MaxHealth;
            }

            // is max health changed?
            if (maxHealth != lastMaxHealth)
            {
                shakeit = false;
            }

            // is health changed?
            if (health < lastHealth && shakeit)
            {
                cam.Shake(200, 0.05f, null, 0, 0);
            }

            // is in car stat changed?
            if (lastInCar != inCar)
            {
                gradbar = health;
            }

            // get weapon equipped and show in hud
            string weaponName = boundedPlayer.GunsOwned[boundedPlayer.GunEquipped].WeaponName;
            if (weaponName == "AK74u")
                weaponTexToDraw = weaponTextures[1];
            else if (weaponName == "M4A1")
                weaponTexToDraw = weaponTextures[2];
            else if (weaponName == "R870MCS")
                weaponTexToDraw = weaponTextures[3];
            else if (weaponName == "M60")
                weaponTexToDraw = weaponTextures[4];
            else
                weaponTexToDraw = weaponTextures[0];

            clipCount = boundedPlayer.GunsOwned[boundedPlayer.GunEquipped].ClipAmmo;
            reserveCount = boundedPlayer.GunsOwned[boundedPlayer.GunEquipped].ReserveAmmo;

            // bar grad lines
            if (gradbar > health && !inCar)
                gradbar -= 2;
            else if (gradbar > health && inCar)
                gradbar -= 5;
            if (gradbar < health)
                gradbar = health;
        }