Exemplo n.º 1
0
        public override void Update(GameTime gametime)
        {
            if (Helper.CurrentGameStatus == GameStatus.PLAYING)
            {
                TilePlayer          player        = (TilePlayer)Game.Services.GetService(typeof(TilePlayer));
                TilePlayerTurret    playerTurret  = (TilePlayerTurret)Game.Services.GetService(typeof(TilePlayerTurret));
                List <SentryTurret> sentryTurrets = (List <SentryTurret>)Game.Services.GetService(typeof(List <SentryTurret>));

                if (player != null && playerTurret != null)
                {
                    if (State == PowerUpStatus.Deactivated && CollisionDetect(player))
                    {
                        Activate();
                    }

                    if (State == PowerUpStatus.Activated || State == PowerUpStatus.ExecuteOnce)
                    {
                        Duration += (float)gametime.ElapsedGameTime.TotalSeconds;

                        if (State != PowerUpStatus.ExecuteOnce)
                        {
                            Affect(player, playerTurret, sentryTurrets);
                        }

                        if (Duration >= MaxLifeTime)
                        {
                            State = PowerUpStatus.Depleted;
                            Deactivate(player, playerTurret, sentryTurrets);
                        }
                    }
                }

                base.Update(gametime);
            }
        }
Exemplo n.º 2
0
        public void Deactivate(TilePlayer other, TilePlayerTurret otherTurret, List <SentryTurret> sentryTurrets)
        {
            switch (Type)
            {
            case PowerUpType.Heal:
                // Do nothing on deactivation
                break;

            case PowerUpType.DefenseBoost:
                foreach (SentryTurret turret in sentryTurrets)
                {
                    if (turret != null)
                    {
                        turret.Bullet.playerDamageRate = defaultPlayerDamageRate;
                    }
                }
                break;

            case PowerUpType.SpeedBoost:
                other.MaxVelocity  = defaultMaxVelocity;
                other.Acceleration = defaultPlayerAcceleration;
                other.Deceleration = defaultPlayerDeceleration;
                other.turnSpeed    = defaultTurnSpeed;
                break;

            case PowerUpType.ExtraDamage:
                otherTurret.Bullet = defaultBullet;
                otherTurret.Bullet.sentryDamageRate = defaultSentryDamageRate;
                otherTurret.ShellSound = defaultShellSnd;
                break;

            case PowerUpType.Camouflage:
                other.Alpha       = 1;
                otherTurret.Alpha = 1;

                List <Sentry> otherTanks = (List <Sentry>)Game.Services.GetService(typeof(List <Sentry>));

                foreach (Sentry tank in otherTanks)
                {
                    if (tank != null)
                    {
                        tank.StayVisible = false;
                    }
                }

                foreach (SentryTurret turret in sentryTurrets)
                {
                    if (turret != null)
                    {
                        turret.DetectRadius = defaultRadius;
                    }
                }
                break;
            }
        }
Exemplo n.º 3
0
        public override void Update(GameTime gametime)
        {
            if (Helper.CurrentGameStatus == GameStatus.PLAYING)
            {
                OrbLight.Position = (CentrePos - Camera.CamPos);

                TilePlayer          player        = (TilePlayer)Game.Services.GetService(typeof(TilePlayer));
                TilePlayerTurret    playerTurret  = (TilePlayerTurret)Game.Services.GetService(typeof(TilePlayerTurret));
                List <SentryTurret> sentryTurrets = (List <SentryTurret>)Game.Services.GetService(typeof(List <SentryTurret>));

                if (player != null && playerTurret != null)
                {
                    if (State == PowerUpStatus.Deactivated && CollisionDetect(player))
                    {
                        Activate();
                    }

                    if (State == PowerUpStatus.Activated || State == PowerUpStatus.ExecuteOnce)
                    {
                        // Comment out to make effects last infinitely.
                        //Duration += (float)gametime.ElapsedGameTime.TotalSeconds;

                        attachToHUD = true;

                        if (State != PowerUpStatus.ExecuteOnce)
                        {
                            Affect(gametime, player, playerTurret, sentryTurrets);
                        }

                        if (Duration >= MaxLifeTime)
                        {
                            State = PowerUpStatus.Depleted;
                            Deactivate(player, playerTurret, sentryTurrets);
                        }
                    }

                    RunToPlayer(player);

                    // Cool Down Timer
                    if (State == PowerUpStatus.Depleted && coolDownTime <= MAX_COOLDOWN)
                    {
                        coolDownTime += (float)gametime.ElapsedGameTime.TotalSeconds;
                    }

                    UpdateHUD(gametime);
                }

                base.Update(gametime);
            }
        }
Exemplo n.º 4
0
        private int defaultRadius;           // Player spotted radius.
        #endregion

        #region Constructors
        public PowerUp(Game game, Vector2 position, List <TileRef> sheetRefs,
                       int frameWidth, int frameHeight, float layerDepth,
                       float maxLifeTime, PowerUpType type, int amount, float multiplier,
                       SoundEffect pickupSnd)
            : base(game, position, sheetRefs, frameWidth, frameHeight, layerDepth)
        {
            Visible          = true;
            DrawOrder        = 100;
            this.Type        = type;
            this.MaxLifeTime = maxLifeTime;
            this.Factor      = multiplier;
            this.Amount      = amount;
            this.State       = PowerUpStatus.Deactivated;

            #region Get Default Values
            TilePlayer          player        = (TilePlayer)Game.Services.GetService(typeof(TilePlayer));
            TilePlayerTurret    playerTurret  = (TilePlayerTurret)Game.Services.GetService(typeof(TilePlayerTurret));
            List <SentryTurret> sentryTurrets = (List <SentryTurret>)Game.Services.GetService(typeof(List <SentryTurret>));

            if (player != null)
            {
                defaultMaxVelocity        = player.MaxVelocity;
                defaultPlayerAcceleration = player.Acceleration;
                defaultPlayerDeceleration = player.Deceleration;
            }

            foreach (SentryTurret turret in sentryTurrets)
            {
                if (turret != null)
                {
                    // Finds first enemy tank in list that's not NULL and takes those as default values.
                    defaultPlayerDamageRate = turret.Bullet.playerDamageRate;
                    defaultRadius           = turret.DetectRadius;
                    break;
                }
            }

            if (playerTurret != null)
            {
                defaultSentryDamageRate = playerTurret.Bullet.sentryDamageRate;
            }
            #endregion

            #region Handle Audio
            this.pickupSnd = pickupSnd;
            pickupSndInst  = this.pickupSnd.CreateInstance();
            #endregion
        }
Exemplo n.º 5
0
        private void Affect(TilePlayer other, TilePlayerTurret otherTurret, List <SentryTurret> sentryTurrets)
        {
            switch (Type)
            {
            case PowerUpType.Heal:
                other.Health += Amount * (int)Factor;
                State         = PowerUpStatus.Depleted;
                break;

            case PowerUpType.DefenseBoost:
                foreach (SentryTurret turret in sentryTurrets)
                {
                    if (turret != null)
                    {
                        turret.Bullet.playerDamageRate /= (int)Factor;
                    }
                }
                State = PowerUpStatus.ExecuteOnce;
                break;

            case PowerUpType.SpeedBoost:
                // Accelerate slowly, gain more speed and stop your tracks faster!
                other.MaxVelocity *= Factor;
                //other.Acceleration = other.Acceleration * Factor;
                other.Deceleration *= Factor;
                State = PowerUpStatus.ExecuteOnce;
                break;

            case PowerUpType.ExtraDamage:
                otherTurret.Bullet.sentryDamageRate *= (int)Factor;
                State = PowerUpStatus.ExecuteOnce;
                break;

            case PowerUpType.Camouflage:
                foreach (SentryTurret turret in sentryTurrets)
                {
                    if (turret != null)
                    {
                        turret.DetectRadius = Amount * (int)Factor;
                    }
                }
                State = PowerUpStatus.ExecuteOnce;
                break;
            }
        }
Exemplo n.º 6
0
        public void Deactivate(TilePlayer other, TilePlayerTurret otherTurret, List <SentryTurret> sentryTurrets)
        {
            switch (Type)
            {
            case PowerUpType.Heal:
                // Do nothing on deactivation
                break;

            case PowerUpType.DefenseBoost:
                foreach (SentryTurret turret in sentryTurrets)
                {
                    if (turret != null)
                    {
                        turret.Bullet.playerDamageRate = defaultPlayerDamageRate;
                    }
                }
                break;

            case PowerUpType.SpeedBoost:
                other.MaxVelocity  = defaultMaxVelocity;
                other.Acceleration = defaultPlayerAcceleration;
                other.Deceleration = defaultPlayerDeceleration;
                break;

            case PowerUpType.ExtraDamage:
                otherTurret.Bullet.sentryDamageRate = defaultSentryDamageRate;
                break;

            case PowerUpType.Camouflage:
                foreach (SentryTurret turret in sentryTurrets)
                {
                    if (turret != null)
                    {
                        turret.DetectRadius = defaultRadius;
                    }
                }
                break;
            }
        }
Exemplo n.º 7
0
        private void Affect(GameTime gameTime, TilePlayer other, TilePlayerTurret otherTurret, List <SentryTurret> sentryTurrets)
        {
            switch (Type)
            {
            case PowerUpType.Heal:
                Frames.Add(new TileRef(13, 2, 0));
                other.Health += Amount * (int)Factor;
                State         = PowerUpStatus.Depleted;
                break;

            case PowerUpType.Regen:
                Frames.Add(new TileRef(13, 2, 0));
                //Duration = 0;
                RegenTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;

                if (other.Health < 100 && other.Health > 0 && RegenTimer > 1)
                {
                    other.Health += Amount * (int)Factor;
                    RegenTimer    = 0;
                }
                break;

            case PowerUpType.DefenseBoost:
                Frames.Add(new TileRef(13, 1, 0));
                foreach (SentryTurret turret in sentryTurrets)
                {
                    if (turret != null)
                    {
                        turret.Bullet.playerDamageRate /= (int)Factor;
                    }
                }
                State = PowerUpStatus.ExecuteOnce;
                break;

            case PowerUpType.SpeedBoost:
                Frames.Add(new TileRef(13, 3, 0));
                other.MaxVelocity *= Factor;
                //other.Acceleration = other.Acceleration * Factor; // Immediately gain speed
                other.Deceleration *= Factor;
                other.turnSpeed    *= (Factor + (Factor / 2));
                State = PowerUpStatus.ExecuteOnce;
                break;

            case PowerUpType.ExtraDamage:
                Frames.Add(new TileRef(13, 0, 0));
                if (newRound != null)
                {
                    otherTurret.Bullet = newRound;
                }
                otherTurret.Bullet.sentryDamageRate *= (int)Factor;
                otherTurret.ShellSound = newRound.shellSoundAlt;
                State = PowerUpStatus.ExecuteOnce;
                break;

            case PowerUpType.Camouflage:
                Frames.Add(new TileRef(13, 4, 0));

                other.Alpha       = 0.5f;
                otherTurret.Alpha = 0.5f;

                foreach (SentryTurret turret in sentryTurrets)
                {
                    if (turret != null)
                    {
                        turret.DetectRadius = Amount * (int)Factor;
                    }
                }

                List <Sentry> otherTanks = (List <Sentry>)Game.Services.GetService(typeof(List <Sentry>));
                foreach (Sentry tank in otherTanks)
                {
                    if (tank != null)
                    {
                        tank.StayVisible = true;
                    }
                }

                State = PowerUpStatus.ExecuteOnce;
                break;
            }
        }
Exemplo n.º 8
0
        private int defaultRadius;           // Player spotted radius.
        #endregion
        #endregion

        #region Constructors
        public PowerUp(Game game, Vector2 position, List <TileRef> sheetRefs,
                       int frameWidth, int frameHeight, float layerDepth,
                       float maxLifeTime, PowerUpType type, int amount, float multiplier,
                       SoundEffect pickupSnd, SoundEffect camoSnd, Ricochet newRound)
            : base(game, position, sheetRefs, frameWidth, frameHeight, layerDepth)
        {
            Visible           = true;
            DrawOrder         = 100;
            this.Type         = type;
            this.MaxLifeTime  = maxLifeTime;
            this.Factor       = multiplier;
            this.Amount       = amount;
            this.State        = PowerUpStatus.Deactivated;
            this.newRound     = newRound;
            BoundingRectangle = new Rectangle(
                PixelPosition.ToPoint(),
                new Point(FrameWidth / 8, FrameHeight / 8));

            #region Get Default Values
            TilePlayer          player        = (TilePlayer)Game.Services.GetService(typeof(TilePlayer));
            TilePlayerTurret    playerTurret  = (TilePlayerTurret)Game.Services.GetService(typeof(TilePlayerTurret));
            List <SentryTurret> sentryTurrets = (List <SentryTurret>)Game.Services.GetService(typeof(List <SentryTurret>));

            if (player != null)
            {
                defaultMaxVelocity        = player.MaxVelocity;
                defaultPlayerAcceleration = player.Acceleration;
                defaultPlayerDeceleration = player.Deceleration;
                defaultTurnSpeed          = player.turnSpeed;
            }

            foreach (SentryTurret turret in sentryTurrets)
            {
                if (turret != null)
                {
                    // Finds first enemy tank in list that's not NULL and takes those as default values.
                    defaultPlayerDamageRate = turret.Bullet.playerDamageRate;
                    defaultRadius           = turret.DetectRadius;
                    break;
                }
            }

            if (playerTurret != null)
            {
                defaultSentryDamageRate = playerTurret.Bullet.sentryDamageRate;
                defaultBullet           = playerTurret.Bullet;
                defaultShellSnd         = playerTurret.ShellSound;
            }
            #endregion

            #region Handle Audio
            this.pickupSnd = pickupSnd;
            pickupSndInst  = this.pickupSnd.CreateInstance();
            #endregion

            #region Setup OrbLight
            PenumbraComponent penumbra = Game.Services.GetService <PenumbraComponent>();
            penumbra.Lights.Add(OrbLight);

            switch (type)
            {
            case PowerUpType.Regen:
            case PowerUpType.Heal:
                OrbLight.Color = Color.LimeGreen;
                break;

            case PowerUpType.DefenseBoost:
                OrbLight.Color = Color.LightBlue;
                break;

            case PowerUpType.SpeedBoost:
                OrbLight.Color = Color.Orange;
                break;

            case PowerUpType.ExtraDamage:
                OrbLight.Color = Color.Red;
                break;

            case PowerUpType.Camouflage:
                OrbLight.Color = Color.Purple;
                break;

            default:
                OrbLight.Color = Color.White;
                break;
            }
            #endregion

            #region Setup Duration Bar
            if (Type == PowerUpType.Camouflage)
            {
                durationBar      = new HealthBar(game, CentrePos);
                durationBar.Name = Type.ToString();
                durationBar.txHealthBar.SetData(new[] { durationBarColor });
                AddHealthBar(durationBar);
                Health = (int)Duration;

                this.camoSnd       = camoSnd;
                camoSndInst        = this.camoSnd.CreateInstance();
                camoSndInst.Volume = 0.8f;
            }
            #endregion
        }
Exemplo n.º 9
0
        protected override void Initialize()
        {
            Window.Position = new Point(
                (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width / 2) -
                (graphics.PreferredBackBufferWidth / 2),
                (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height / 2) -
                (graphics.PreferredBackBufferHeight / 2));

            new InputEngine(this);

            // Add Camera
            CurrentCamera = new Camera(this, Vector2.Zero,
                                       new Vector2((tileMap.GetLength(1) * tileWidth),
                                                   (tileMap.GetLength(0) * tileHeight)));
            Services.AddService(CurrentCamera);

            #region Create Player Tank
            TilePlayer tankPlayer = new TilePlayer(this, new Vector2(96, 192), new List <TileRef>()
            {
                new TileRef(10, 0, 0),
            }, 64, 64, 0f,
                                                   Content.Load <SoundEffect>("audio/PlayerTankHum"),
                                                   Content.Load <SoundEffect>("audio/PlayerTankTracks"));

            TilePlayerTurret tankPlayerTurret = new TilePlayerTurret(this, tankPlayer.PixelPosition, new List <TileRef>()
            {
                new TileRef(10, 1, 0),
            }, 64, 64, 0f,
                                                                     Content.Load <SoundEffect>("audio/PlayerTankShoot"),
                                                                     Content.Load <SoundEffect>("audio/PlayerTankReload"),
                                                                     Content.Load <SoundEffect>("audio/PlayerTurretTurn"),
                                                                     Content.Load <SoundEffect>("audio/TankExplosion"));

            // Add Tank Projectile
            const int PLAYER_BULLET_SPD = 25;

            Projectile bullet = new Projectile(this, "PLAYER", tankPlayerTurret.CentrePos, new List <TileRef>()
            {
                new TileRef(10, 2, 0),
            }, 64, 64, 0f, tankPlayerTurret.Direction, PLAYER_BULLET_SPD,
                                               Content.Load <SoundEffect>("audio/TankShoot"),
                                               Content.Load <SoundEffect>("audio/TankArmorPierce"));

            tankPlayerTurret.AddProjectile(bullet);
            Services.AddService(bullet);

            Services.AddService(tankPlayer);
            Services.AddService(tankPlayerTurret);
            #endregion

            #region Load Animated Sprites
            MuzzleFlash muzzleFlash = new MuzzleFlash(this, tankPlayerTurret.PixelPosition, new List <TileRef>()
            {
                new TileRef(11, 1, 0),
                new TileRef(11, 0, 0),
            }, 64, 64, 0f);

            MuzzleFlashSentry muzzleFlashSentry = new MuzzleFlashSentry(this, tankPlayerTurret.PixelPosition, new List <TileRef>()
            {
                new TileRef(11, 0, 0),
                new TileRef(11, 1, 0),
            }, 64, 64, 0f);

            BulletExplosion bulletExplosionSprite = new BulletExplosion(this, bullet.PixelPosition, new List <TileRef>()
            {
                new TileRef(0, 7, 0),
                new TileRef(1, 7, 0),
                new TileRef(2, 7, 0),
                new TileRef(3, 7, 0),
                new TileRef(4, 7, 0),
                new TileRef(5, 7, 0),
                new TileRef(6, 7, 0),
                new TileRef(7, 7, 0)
            }, 64, 64, 0f);

            TankExplosion tankExplosionSprite = new TankExplosion(this, tankPlayer.PixelPosition, new List <TileRef>()
            {
                new TileRef(0, 6, 0),
                new TileRef(1, 6, 0),
                new TileRef(2, 6, 0),
                new TileRef(3, 6, 0),
                new TileRef(4, 6, 0),
                new TileRef(5, 6, 0),
                new TileRef(6, 6, 0),
                new TileRef(7, 6, 0)
            }, 64, 64, 0f);
            #endregion

            #region Add Animated Sprites to Services
            Services.AddService(muzzleFlash);
            Services.AddService(muzzleFlashSentry);
            Services.AddService(tankExplosionSprite);
            Services.AddService(bulletExplosionSprite);
            #endregion

            #region Create Sentry Tanks
            // Tank Rotations
            const float ANGLE_VERTICAL   = 1.574f;
            const float ANGLE_HORIZONTAL = 3.15f;
            const float ANGLE_DIAG_LEFT  = 2.4f;  // Minus for up left
            const float ANGLE_DIAG_RIGHT = 0.75f; // Minus for up right

            // Y = 325
            Sentry enemyOne = new Sentry(this, new Vector2(700, 200), new List <TileRef>()
            {
                new TileRef(10, 4, 0),
            }, 64, 64, 0f, "Enemy Tank 1",
                                         Content.Load <SoundEffect>("audio/PlayerTankHum"),
                                         Content.Load <SoundEffect>("audio/PlayerTankTracks"),
                                         -ANGLE_DIAG_LEFT);

            //Sentry enemyTwo = new Sentry(this, new Vector2(1180, 237), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 2", ANGLE_VERTICAL);

            //Sentry enemyThree = new Sentry(this, new Vector2(2020, 295), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 3", ANGLE_VERTICAL);

            //Sentry enemyFour = new Sentry(this, new Vector2(2617, 549), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 4", ANGLE_DIAG_LEFT);

            //Sentry enemyFive = new Sentry(this, new Vector2(3490, 42), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 5", ANGLE_DIAG_LEFT);

            //Sentry enemySix = new Sentry(this, new Vector2(3609, 318), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 6", ANGLE_HORIZONTAL);

            //Sentry enemySeven = new Sentry(this, new Vector2(2882, 49), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 7", ANGLE_VERTICAL);

            //Sentry enemyEight = new Sentry(this, new Vector2(3390, 860), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 8", -ANGLE_HORIZONTAL);

            //Sentry enemyNine = new Sentry(this, new Vector2(3455, 1442), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 9", ANGLE_DIAG_LEFT);

            //Sentry enemyTen = new Sentry(this, new Vector2(2845, 1760), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 10", -ANGLE_HORIZONTAL);

            //Sentry enemyEleven = new Sentry(this, new Vector2(2316, 1345), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 11", -ANGLE_HORIZONTAL);

            //Sentry enemyTwelve = new Sentry(this, new Vector2(54, 1916), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 12", -ANGLE_DIAG_RIGHT);

            //Sentry enemyThirteen = new Sentry(this, new Vector2(175, 1188), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 13", ANGLE_DIAG_RIGHT);

            //Sentry enemyFourteen = new Sentry(this, new Vector2(45, 766), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 14", 0f);

            #endregion

            #region Add Sentry's to List
            Sentries.Add(enemyOne);
            //Sentries.Add(enemyTwo);
            //Sentries.Add(enemyThree);
            //Sentries.Add(enemyFour);
            //Sentries.Add(enemyFive);
            //Sentries.Add(enemySix);
            //Sentries.Add(enemySeven);
            //Sentries.Add(enemyEight);
            //Sentries.Add(enemyNine);
            //Sentries.Add(enemyTen);
            //Sentries.Add(enemyEleven);
            //Sentries.Add(enemyTwelve);
            //Sentries.Add(enemyThirteen);
            //Sentries.Add(enemyFourteen);

            Services.AddService(Sentries);
            #endregion

            #region Create Sentry Tank Turrets

            SentryTurret enemyTurretOne = new SentryTurret(this, enemyOne.PixelPosition, new List <TileRef>()
            {
                new TileRef(10, 5, 0),
            }, 64, 64, 0f, "Enemy Tank 1", -ANGLE_VERTICAL, Content.Load <SoundEffect>("audio/SentryTurretTurn"),
                                                           Content.Load <SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretTwo = new SentryTurret(this, enemyTwo.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 2", ANGLE_VERTICAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretThree = new SentryTurret(this, enemyThree.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 3", ANGLE_VERTICAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretFour = new SentryTurret(this, enemyFour.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 4", -ANGLE_HORIZONTAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretFive = new SentryTurret(this, enemyFive.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 5", -ANGLE_HORIZONTAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretSix = new SentryTurret(this, enemySix.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 6", -ANGLE_HORIZONTAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretSeven = new SentryTurret(this, enemySeven.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 7", ANGLE_VERTICAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretEight = new SentryTurret(this, enemyEight.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 8", -ANGLE_HORIZONTAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretNine = new SentryTurret(this, enemyNine.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 9", ANGLE_VERTICAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretTen = new SentryTurret(this, enemyTen.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 10", -ANGLE_HORIZONTAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretEleven = new SentryTurret(this, enemyEleven.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 11", -ANGLE_HORIZONTAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretTwelve = new SentryTurret(this, enemyTwelve.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 12", -ANGLE_VERTICAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretThirteen = new SentryTurret(this, enemyThirteen.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 13", ANGLE_VERTICAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretFourteen = new SentryTurret(this, enemyFourteen.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 14", 0f, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            #endregion

            #region Add Sentry Turrets to List
            SentryTurrets.Add(enemyTurretOne);
            //SentryTurrets.Add(enemyTurretTwo);
            //SentryTurrets.Add(enemyTurretThree);
            //SentryTurrets.Add(enemyTurretFour);
            //SentryTurrets.Add(enemyTurretFive);
            //SentryTurrets.Add(enemyTurretSix);
            //SentryTurrets.Add(enemyTurretSeven);
            //SentryTurrets.Add(enemyTurretEight);
            //SentryTurrets.Add(enemyTurretNine);
            //SentryTurrets.Add(enemyTurretTen);
            //SentryTurrets.Add(enemyTurretEleven);
            //SentryTurrets.Add(enemyTurretTwelve);
            //SentryTurrets.Add(enemyTurretThirteen);
            //SentryTurrets.Add(enemyTurretFourteen);

            Services.AddService(SentryTurrets);
            #endregion

            #region Create Sentry Tank Projectiles
            int ENEMY_BULLET_SPD = tankPlayerTurret.Bullet.Velocity / 4;

            Projectile enemyBulletOne = new Projectile(this, "SENTRY", new Vector2(0, 0), new List <TileRef>()
            {
                new TileRef(10, 2, 0),
            }, 64, 64, 0f, enemyTurretOne.Direction, ENEMY_BULLET_SPD,
                                                       Content.Load <SoundEffect>("audio/SentryTankShoot"),
                                                       Content.Load <SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletTwo = new Projectile(this, "SENTRY", new Vector2(0,0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretTwo.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShootAlt"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletThree = new Projectile(this, "SENTRY", new Vector2(0,0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretThree.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShootAlt"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletFour = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretFour.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShoot"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletFive = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretFive.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShootAlt"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletSix = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretSix.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShoot"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletSeven = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretSeven.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShoot"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletEight = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretEight.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShootAlt"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletNine = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretNine.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShootAlt"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletTen = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretTen.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShoot"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletEleven = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretEleven.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShootAlt"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletTwelve = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretTwelve.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShootAlt"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletThirteen = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretThirteen.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShoot"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletFourteen = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretFourteen.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShootAlt"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            List <Projectile> sentryProjectiles = new List <Projectile>()
            {
                enemyBulletOne//, enemyBulletTwo, enemyBulletThree,
                //enemyBulletFour, enemyBulletFive, enemyBulletSix,
                //enemyBulletFive, enemyBulletSeven, enemyBulletEight,
                //enemyBulletNine, enemyBulletTen, enemyBulletEleven,
                //enemyBulletTwelve, enemyBulletThirteen, enemyBulletFourteen
            };

            for (int i = 0; i < SentryTurrets.Count; i++)
            {
                sentryProjectiles[i].explosionLifeSpan = bullet.explosionLifeSpan * 2;
                SentryTurrets[i].AddProjectile(sentryProjectiles[i]);
            }
            #endregion

            #region Add PowerUps
            //PowerUp Speed = new PowerUp(this, new Vector2(200, 192), new List<TileRef>()
            //{
            //    new TileRef(4,3,0),
            //}, 64, 64, 0f, 5, PowerUp.PowerUpType.SpeedBoost, 0, 2,
            //Content.Load<SoundEffect>(@"audio/Resupply"));

            //PowerUp Heal = new PowerUp(this, new Vector2(500, 192), new List<TileRef>()
            //{
            //    new TileRef(4,3,0),
            //}, 64, 64, 0f, 1, PowerUp.PowerUpType.Heal, 50, 1,
            //Content.Load<SoundEffect>(@"audio/Resupply"));

            //PowerUp DefenseBoost = new PowerUp(this, new Vector2(500, 192), new List<TileRef>()
            //{
            //    new TileRef(4,3,0),
            //}, 64, 64, 0f, 60, PowerUp.PowerUpType.DefenseBoost, 0, 2,
            //Content.Load<SoundEffect>(@"audio/Resupply"));

            //PowerUp ExtraDamage = new PowerUp(this, new Vector2(500, 192), new List<TileRef>()
            //{
            //    new TileRef(4,3,0),
            //}, 64, 64, 0f, 60, PowerUp.PowerUpType.ExtraDamage, 0, 2,
            //Content.Load<SoundEffect>(@"audio/Resupply"));

            //PowerUp Camouflage = new PowerUp(this, new Vector2(500, 192), new List<TileRef>()
            //{
            //    new TileRef(4,3,0),
            //}, 64, 64, 0f, 5, PowerUp.PowerUpType.Camouflage, 0, 0,
            //Content.Load<SoundEffect>(@"audio/Resupply"));
            #endregion

            #region Add Crosshair
            new Crosshair(this, new Vector2(0, 0), new List <TileRef>()
            {
                new TileRef(10, 3, 0),
            }, 64, 64, 0f);
            #endregion

            #region Set Collisions
            SetCollider(TileType.DIRT);
            SetCollider(TileType.METAL);
            SetTrigger(TileType.DIRT2); // For WIN condition
            #endregion

            base.Initialize();
        }
Exemplo n.º 10
0
        protected override void Initialize()
        {
            Window.Position = new Point(
                (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width / 2) -
                (graphics.PreferredBackBufferWidth / 2),
                (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height / 2) -
                (graphics.PreferredBackBufferHeight / 2));

            new InputEngine(this);

            // Add Camera
            CurrentCamera = new Camera(this, Vector2.Zero,
                                       new Vector2((tileMap.GetLength(1) * tileWidth),
                                                   (tileMap.GetLength(0) * tileHeight)));
            Services.AddService(CurrentCamera);

            #region Create Player Tank
            TilePlayer tankPlayer = new TilePlayer(this, new Vector2(96, 192), new List <TileRef>()
            {
                new TileRef(10, 0, 0),
            }, 64, 64, 0f,
                                                   Content.Load <SoundEffect>("audio/PlayerTankHum"),
                                                   Content.Load <SoundEffect>("audio/PlayerTankTracks"),
                                                   Content.Load <SoundEffect>("audio/PlayerWarning"),
                                                   Content.Load <SoundEffect>("audio/Heartbeat"));

            TilePlayerTurret tankPlayerTurret = new TilePlayerTurret(this, tankPlayer.PixelPosition, new List <TileRef>()
            {
                new TileRef(10, 1, 0),
            }, 64, 64, 0f,
                                                                     Content.Load <SoundEffect>("audio/PlayerTankShoot"),
                                                                     Content.Load <SoundEffect>("audio/PlayerTankReload2"),
                                                                     Content.Load <SoundEffect>("audio/PlayerTankReload"),
                                                                     Content.Load <SoundEffect>("audio/PlayerTurretTurn"),
                                                                     Content.Load <SoundEffect>("audio/TankExplosion"));

            // Add Tank Projectile
            const int PLAYER_BULLET_SPD = 8;

            Projectile bullet = new Projectile(this, "PLAYER", tankPlayerTurret.CentrePos, new List <TileRef>()
            {
                new TileRef(10, 2, 0),
            }, 64, 64, 0f, tankPlayerTurret.Direction, PLAYER_BULLET_SPD,
                                               Content.Load <SoundEffect>("audio/TankShoot"),
                                               Content.Load <SoundEffect>("audio/TankArmorPierce"));
            tankPlayerTurret.AddProjectile(bullet);

            Ricochet ricochetRound = new Ricochet(this, "PLAYER", tankPlayerTurret.CentrePos, new List <TileRef>()
            {
                new TileRef(11, 2, 0),
            }, 64, 64, 0f, tankPlayerTurret.Direction, PLAYER_BULLET_SPD,
                                                  Content.Load <SoundEffect>("audio/TankShoot"),
                                                  Content.Load <SoundEffect>("audio/TankArmorPierce"),
                                                  Content.Load <SoundEffect>("audio/PlayerTankShootAlt"));

            Services.AddService(ricochetRound);
            Services.AddService(bullet);
            Services.AddService(tankPlayer);
            Services.AddService(tankPlayerTurret);
            #endregion

            // Tank Rotations
            const float ANGLE_DOWN       = 1.574f;
            const float ANGLE_RIGHT      = 3.15f;
            const float ANGLE_DIAG_LEFT  = 2.4f;  // Minus for top left
            const float ANGLE_DIAG_RIGHT = 0.75f; // Minus for top right

            #region Create Sentry Tanks
            List <Vector2> SentryPositions = new List <Vector2>
            {
                new Vector2(958, 197),
                new Vector2(200, 768),
                new Vector2(350, 1287),
                new Vector2(2304, 1820),
                new Vector2(3590, 1794),
                new Vector2(3555, 866),
                new Vector2(2580, 180),
                new Vector2(3562, 184),
                new Vector2(2129, 474),
                new Vector2(1374, 251),
            };

            Shuffle(SentryPositions); // Randomize

            Sentry enemyOne = new Sentry(this, SentryPositions[0], new List <TileRef>()
            {
                new TileRef(10, 4, 0),
            }, 64, 64, 0f, "Enemy Tank 1",
                                         Content.Load <SoundEffect>("audio/SentryTankHum"),
                                         Content.Load <SoundEffect>("audio/SentryTankTracks"),
                                         -ANGLE_RIGHT);

            Sentry enemyTwo = new Sentry(this, SentryPositions[1], new List <TileRef>()
            {
                new TileRef(10, 4, 0),
            }, 64, 64, 0f, "Enemy Tank 2",
                                         Content.Load <SoundEffect>("audio/SentryTankHum"),
                                         Content.Load <SoundEffect>("audio/SentryTankTracks"),
                                         0);

            Sentry enemyThree = new Sentry(this, SentryPositions[2], new List <TileRef>()
            {
                new TileRef(10, 4, 0),
            }, 64, 64, 0f, "Enemy Tank 3",
                                           Content.Load <SoundEffect>("audio/SentryTankHum"),
                                           Content.Load <SoundEffect>("audio/SentryTankTracks"),
                                           ANGLE_DIAG_RIGHT);

            Sentry enemyFour = new Sentry(this, SentryPositions[3], new List <TileRef>()
            {
                new TileRef(10, 4, 0),
            }, 64, 64, 0f, "Enemy Tank 4",
                                          Content.Load <SoundEffect>("audio/SentryTankHum"),
                                          Content.Load <SoundEffect>("audio/SentryTankTracks"),
                                          -ANGLE_RIGHT);

            Sentry enemyFive = new Sentry(this, SentryPositions[4], new List <TileRef>()
            {
                new TileRef(10, 4, 0),
            }, 64, 64, 0f, "Enemy Tank 5",
                                          Content.Load <SoundEffect>("audio/SentryTankHum"),
                                          Content.Load <SoundEffect>("audio/SentryTankTracks"),
                                          -ANGLE_RIGHT);

            Sentry enemySix = new Sentry(this, SentryPositions[5], new List <TileRef>()
            {
                new TileRef(10, 4, 0),
            }, 64, 64, 0f, "Enemy Tank 6",
                                         Content.Load <SoundEffect>("audio/SentryTankHum"),
                                         Content.Load <SoundEffect>("audio/SentryTankTracks"),
                                         ANGLE_DOWN);

            Sentry enemySeven = new Sentry(this, SentryPositions[6], new List <TileRef>()
            {
                new TileRef(10, 4, 0),
            }, 64, 64, 0f, "Enemy Tank 7",
                                           Content.Load <SoundEffect>("audio/SentryTankHum"),
                                           Content.Load <SoundEffect>("audio/SentryTankTracks"),
                                           0);

            LightSentry enemyEight = new LightSentry(this, SentryPositions[7], new List <TileRef>()
            {
                new TileRef(10, 6, 0),
            }, 64, 64, 0f, "Enemy Tank 8",
                                                     Content.Load <SoundEffect>("audio/SentryTankHum"),
                                                     Content.Load <SoundEffect>("audio/SentryTankTracks"),
                                                     -ANGLE_RIGHT);

            LightSentry enemyNine = new LightSentry(this, SentryPositions[8], new List <TileRef>()
            {
                new TileRef(10, 6, 0),
            }, 64, 64, 0f, "Enemy Tank 9",
                                                    Content.Load <SoundEffect>("audio/SentryTankHum"),
                                                    Content.Load <SoundEffect>("audio/SentryTankTracks"),
                                                    -ANGLE_RIGHT);

            HeavySentry enemyTen = new HeavySentry(this, SentryPositions[9], new List <TileRef>()
            {
                new TileRef(11, 4, 0),
            }, 64, 64, 0f, "Enemy Tank 10",
                                                   Content.Load <SoundEffect>("audio/SentryTankHum"),
                                                   Content.Load <SoundEffect>("audio/SentryTankTracks"),
                                                   ANGLE_DOWN);

            //Sentry enemyEleven = new Sentry(this, new Vector2(2316, 1345), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 11", -ANGLE_HORIZONTAL);

            //Sentry enemyTwelve = new Sentry(this, new Vector2(54, 1916), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 12", -ANGLE_DIAG_RIGHT);

            //Sentry enemyThirteen = new Sentry(this, new Vector2(175, 1188), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 13", ANGLE_DIAG_RIGHT);

            //Sentry enemyFourteen = new Sentry(this, new Vector2(45, 766), new List<TileRef>()
            //{
            //    new TileRef(10, 4, 0),
            //}, 64, 64, 0f, "Enemy Tank 14", 0f);

            #endregion

            #region Add Sentries to List
            Sentries.Add(enemyOne);
            Sentries.Add(enemyTwo);
            Sentries.Add(enemyThree);
            Sentries.Add(enemyFour);
            Sentries.Add(enemyFive);
            Sentries.Add(enemySix);
            Sentries.Add(enemySeven);
            Sentries.Add(enemyEight);
            Sentries.Add(enemyNine);
            Sentries.Add(enemyTen);
            //Sentries.Add(enemyEleven);
            //Sentries.Add(enemyTwelve);
            //Sentries.Add(enemyThirteen);
            //Sentries.Add(enemyFourteen);

            Services.AddService(Sentries);
            #endregion

            #region Create Sentry Tank Turrets

            SentryTurret enemyTurretOne = new SentryTurret(this, enemyOne.PixelPosition, new List <TileRef>()
            {
                new TileRef(10, 5, 0),
            }, 64, 64, 0f, "Enemy Tank 1", -ANGLE_RIGHT, Content.Load <SoundEffect>("audio/SentryTurretTurn"),
                                                           Content.Load <SoundEffect>("audio/TankExplosion"));

            SentryTurret enemyTurretTwo = new SentryTurret(this, enemyTwo.PixelPosition, new List <TileRef>()
            {
                new TileRef(10, 5, 0),
            }, 64, 64, 0f, "Enemy Tank 2", ANGLE_RIGHT, Content.Load <SoundEffect>("audio/SentryTurretTurn"),
                                                           Content.Load <SoundEffect>("audio/TankExplosion"));

            SentryTurret enemyTurretThree = new SentryTurret(this, enemyThree.PixelPosition, new List <TileRef>()
            {
                new TileRef(10, 5, 0),
            }, 64, 64, 0f, "Enemy Tank 3", -ANGLE_DIAG_RIGHT, Content.Load <SoundEffect>("audio/SentryTurretTurn"),
                                                             Content.Load <SoundEffect>("audio/TankExplosion"));

            SentryTurret enemyTurretFour = new SentryTurret(this, enemyFour.PixelPosition, new List <TileRef>()
            {
                new TileRef(10, 5, 0),
            }, 64, 64, 0f, "Enemy Tank 4", -ANGLE_RIGHT, Content.Load <SoundEffect>("audio/SentryTurretTurn"),
                                                            Content.Load <SoundEffect>("audio/TankExplosion"));

            SentryTurret enemyTurretFive = new SentryTurret(this, enemyFive.PixelPosition, new List <TileRef>()
            {
                new TileRef(10, 5, 0),
            }, 64, 64, 0f, "Enemy Tank 5", -ANGLE_RIGHT, Content.Load <SoundEffect>("audio/SentryTurretTurn"),
                                                            Content.Load <SoundEffect>("audio/TankExplosion"));

            SentryTurret enemyTurretSix = new SentryTurret(this, enemySix.PixelPosition, new List <TileRef>()
            {
                new TileRef(10, 5, 0),
            }, 64, 64, 0f, "Enemy Tank 6", ANGLE_DOWN, Content.Load <SoundEffect>("audio/SentryTurretTurn"),
                                                           Content.Load <SoundEffect>("audio/TankExplosion"));

            SentryTurret enemyTurretSeven = new SentryTurret(this, enemySeven.PixelPosition, new List <TileRef>()
            {
                new TileRef(10, 5, 0),
            }, 64, 64, 0f, "Enemy Tank 7", 0, Content.Load <SoundEffect>("audio/SentryTurretTurn"),
                                                             Content.Load <SoundEffect>("audio/TankExplosion"));

            LightSentryTurret enemyTurretEight = new LightSentryTurret(this, enemyEight.PixelPosition, new List <TileRef>()
            {
                new TileRef(11, 6, 0),
            }, 64, 64, 0f, "Enemy Tank 8", -ANGLE_RIGHT, Content.Load <SoundEffect>("audio/SentryTurretTurn"),
                                                                       Content.Load <SoundEffect>("audio/TankExplosion"));

            LightSentryTurret enemyTurretNine = new LightSentryTurret(this, enemyNine.PixelPosition, new List <TileRef>()
            {
                new TileRef(11, 6, 0),
            }, 64, 64, 0f, "Enemy Tank 9", -ANGLE_RIGHT, Content.Load <SoundEffect>("audio/SentryTurretTurn"),
                                                                      Content.Load <SoundEffect>("audio/TankExplosion"));

            HeavySentryTurret enemyTurretTen = new HeavySentryTurret(this, enemyTen.PixelPosition, new List <TileRef>()
            {
                new TileRef(11, 5, 0),
            }, 64, 64, 0f, "Enemy Tank 10", ANGLE_DOWN, Content.Load <SoundEffect>("audio/SentryTurretTurn"),
                                                                     Content.Load <SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretEleven = new SentryTurret(this, enemyEleven.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 11", -ANGLE_HORIZONTAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretTwelve = new SentryTurret(this, enemyTwelve.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 12", -ANGLE_VERTICAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretThirteen = new SentryTurret(this, enemyThirteen.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 13", ANGLE_VERTICAL, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            //SentryTurret enemyTurretFourteen = new SentryTurret(this, enemyFourteen.PixelPosition, new List<TileRef>()
            //{
            //    new TileRef(10, 5, 0),
            //}, 64, 64, 0f, "Enemy Tank 14", 0f, Content.Load<SoundEffect>("audio/SentryTurretTurn"),
            //Content.Load<SoundEffect>("audio/TankExplosion"));

            #endregion

            #region Add Sentry Turrets to List
            SentryTurrets.Add(enemyTurretOne);
            SentryTurrets.Add(enemyTurretTwo);
            SentryTurrets.Add(enemyTurretThree);
            SentryTurrets.Add(enemyTurretFour);
            SentryTurrets.Add(enemyTurretFive);
            SentryTurrets.Add(enemyTurretSix);
            SentryTurrets.Add(enemyTurretSeven);
            SentryTurrets.Add(enemyTurretEight);
            SentryTurrets.Add(enemyTurretNine);
            SentryTurrets.Add(enemyTurretTen);
            //SentryTurrets.Add(enemyTurretEleven);
            //SentryTurrets.Add(enemyTurretTwelve);
            //SentryTurrets.Add(enemyTurretThirteen);
            //SentryTurrets.Add(enemyTurretFourteen);

            Services.AddService(SentryTurrets);
            #endregion

            #region Create Sentry Tank Projectiles
            int ENEMY_BULLET_SPD = PLAYER_BULLET_SPD - PLAYER_BULLET_SPD / 2;

            Projectile enemyBulletOne = new Projectile(this, "SENTRY", enemyOne.PixelPosition, new List <TileRef>()
            {
                new TileRef(10, 2, 0),
            }, 64, 64, 0f, enemyTurretOne.Direction, ENEMY_BULLET_SPD,
                                                       Content.Load <SoundEffect>("audio/SentryTankShoot"),
                                                       Content.Load <SoundEffect>("audio/TankArmorPierce"));

            Projectile enemyBulletTwo = new Projectile(this, "SENTRY", enemyTwo.PixelPosition, new List <TileRef>()
            {
                new TileRef(10, 2, 0),
            }, 64, 64, 0f, enemyTurretTwo.Direction, ENEMY_BULLET_SPD,
                                                       Content.Load <SoundEffect>("audio/SentryTankShootAlt"),
                                                       Content.Load <SoundEffect>("audio/TankArmorPierce"));

            Projectile enemyBulletThree = new Projectile(this, "SENTRY", new Vector2(0, 0), new List <TileRef>()
            {
                new TileRef(10, 2, 0),
            }, 64, 64, 0f, enemyTurretThree.Direction, ENEMY_BULLET_SPD,
                                                         Content.Load <SoundEffect>("audio/SentryTankShootAlt"),
                                                         Content.Load <SoundEffect>("audio/TankArmorPierce"));

            Projectile enemyBulletFour = new Projectile(this, "SENTRY", new Vector2(0, 0), new List <TileRef>()
            {
                new TileRef(10, 2, 0),
            }, 64, 64, 0f, enemyTurretFour.Direction, ENEMY_BULLET_SPD,
                                                        Content.Load <SoundEffect>("audio/SentryTankShoot"),
                                                        Content.Load <SoundEffect>("audio/TankArmorPierce"));

            Projectile enemyBulletFive = new Projectile(this, "SENTRY", new Vector2(0, 0), new List <TileRef>()
            {
                new TileRef(10, 2, 0),
            }, 64, 64, 0f, enemyTurretFive.Direction, ENEMY_BULLET_SPD,
                                                        Content.Load <SoundEffect>("audio/SentryTankShootAlt"),
                                                        Content.Load <SoundEffect>("audio/TankArmorPierce"));

            Projectile enemyBulletSix = new Projectile(this, "SENTRY", new Vector2(0, 0), new List <TileRef>()
            {
                new TileRef(10, 2, 0),
            }, 64, 64, 0f, enemyTurretSix.Direction, ENEMY_BULLET_SPD,
                                                       Content.Load <SoundEffect>("audio/SentryTankShoot"),
                                                       Content.Load <SoundEffect>("audio/TankArmorPierce"));

            Projectile enemyBulletSeven = new Projectile(this, "SENTRY", new Vector2(0, 0), new List <TileRef>()
            {
                new TileRef(10, 2, 0),
            }, 64, 64, 0f, enemyTurretSeven.Direction, ENEMY_BULLET_SPD,
                                                         Content.Load <SoundEffect>("audio/SentryTankShoot"),
                                                         Content.Load <SoundEffect>("audio/TankArmorPierce"));

            Ricochet enemyBulletEight = new Ricochet(this, "SENTRY", new Vector2(0, 0), new List <TileRef>()
            {
                new TileRef(11, 7, 0),
            }, 64, 64, 0f, enemyTurretEight.Direction, (ENEMY_BULLET_SPD + ENEMY_BULLET_SPD / 3),
                                                     Content.Load <SoundEffect>("audio/SentryTankShootLight"),
                                                     Content.Load <SoundEffect>("audio/TankArmorPierce"), null);

            Ricochet enemyBulletNine = new Ricochet(this, "SENTRY", new Vector2(0, 0), new List <TileRef>()
            {
                new TileRef(11, 7, 0),
            }, 64, 64, 0f, enemyTurretNine.Direction, (ENEMY_BULLET_SPD + ENEMY_BULLET_SPD / 3),
                                                    Content.Load <SoundEffect>("audio/SentryTankShootLight"),
                                                    Content.Load <SoundEffect>("audio/TankArmorPierce"), null);

            Ricochet enemyBulletTen = new Ricochet(this, "SENTRY", new Vector2(0, 0), new List <TileRef>()
            {
                new TileRef(10, 7, 0),
            }, 64, 64, 0f, enemyTurretTen.Direction, PLAYER_BULLET_SPD,
                                                   Content.Load <SoundEffect>("audio/SentryTankShootHeavy"),
                                                   Content.Load <SoundEffect>("audio/TankArmorPierce"), null);

            //Projectile enemyBulletEleven = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretEleven.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShootAlt"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletTwelve = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretTwelve.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShootAlt"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletThirteen = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretThirteen.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShoot"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            //Projectile enemyBulletFourteen = new Projectile(this, "SENTRY", new Vector2(0, 0), new List<TileRef>()
            //{
            //    new TileRef(10, 2, 0),
            //}, 64, 64, 0f, enemyTurretFourteen.Direction, ENEMY_BULLET_SPD,
            //Content.Load<SoundEffect>("audio/SentryTankShootAlt"),
            //Content.Load<SoundEffect>("audio/TankArmorPierce"));

            List <Projectile> sentryProjectiles = new List <Projectile>()
            {
                enemyBulletOne, enemyBulletTwo, enemyBulletThree,
                enemyBulletFour, enemyBulletFive, enemyBulletSix,
                enemyBulletSeven, enemyBulletEight, enemyBulletNine,
                enemyBulletTen//, enemyBulletEleven, enemyBulletTwelve,
                //enemyBulletThirteen, enemyBulletFourteen
            };

            for (int i = 0; i < SentryTurrets.Count; i++)
            {
                // Shooting Speed
                sentryProjectiles[i].explosionLifeSpan = sentryProjectiles[i].explosionLifeSpan * 2;
                // Bullet Life Span
                sentryProjectiles[i].flyingLifeSpan = sentryProjectiles[i].flyingLifeSpan + 0.25f;
                SentryTurrets[i].AddProjectile(sentryProjectiles[i]);
            }
            Services.AddService(sentryProjectiles);

            // Heavy Tank Turret Bullet NULL FIX
            enemyTurretTen.UpdateProjectile();
            #endregion

            #region Add Tank Crew
            List <Vector2> CrewmanPositions = new List <Vector2>
            {
                new Vector2(165, 1827),
                new Vector2(194, 863),
                new Vector2(2707, 1758),
                new Vector2(3612, 244),
                new Vector2(1306, 152)
            };

            Shuffle(CrewmanPositions);

            #region Tank Wreck Sprites
            TankWreckSprite[] WreckSprites = new TankWreckSprite[CrewmanPositions.Count];
            for (int i = 0; i < CrewmanPositions.Count; i++)
            {
                WreckSprites[i] = new TankWreckSprite(this, CrewmanPositions[i] + new Vector2(10, 6),
                                                      new List <TileRef>()
                {
                    new TileRef(9, 6, 0)
                }, 64, 64, 0f);
            }

            WreckSprites[0].angleOfRotation = -ANGLE_DIAG_RIGHT;
            WreckSprites[1].angleOfRotation = -ANGLE_DIAG_RIGHT;
            WreckSprites[2].angleOfRotation = ANGLE_RIGHT;
            WreckSprites[3].angleOfRotation = ANGLE_RIGHT;
            WreckSprites[4].angleOfRotation = ANGLE_DIAG_RIGHT;
            #endregion

            //PowerUp Heal = new PowerUp(this, new Vector2(500, 192), new List<TileRef>()
            //{
            //    new TileRef(12,2,0),
            //}, 64, 64, 0f, 1, PowerUp.PowerUpType.Heal, 50, 1,
            //Content.Load<SoundEffect>(@"audio/Rescue3"));

            PowerUp Speed = new PowerUp(this, CrewmanPositions[0], new List <TileRef>()
            {
                new TileRef(12, 3, 0)
            }, 64, 64, 0f, 5, PowerUp.PowerUpType.SpeedBoost, 0, 1.1f,
                                        Content.Load <SoundEffect>(@"audio/Rescue1"), null, null);

            PowerUp Regen = new PowerUp(this, CrewmanPositions[1], new List <TileRef>()
            {
                new TileRef(12, 2, 0),
            }, 64, 64, 0f, 1, PowerUp.PowerUpType.Regen, 1, 1,
                                        Content.Load <SoundEffect>(@"audio/Rescue2"), null, null);

            PowerUp DefenseBoost = new PowerUp(this, CrewmanPositions[2], new List <TileRef>()
            {
                new TileRef(12, 1, 0),
            }, 64, 64, 0f, 60, PowerUp.PowerUpType.DefenseBoost, 0, 2,
                                               Content.Load <SoundEffect>(@"audio/Rescue3"), null, null);

            PowerUp ExtraDamage = new PowerUp(this, CrewmanPositions[3], new List <TileRef>()
            {
                new TileRef(12, 0, 0),
            }, 64, 64, 0f, 60, PowerUp.PowerUpType.ExtraDamage, 0, 2,
                                              Content.Load <SoundEffect>(@"audio/Rescue4"), null, ricochetRound);

            SoundEffect CamoSound = Content.Load <SoundEffect>(@"audio/PlayerActiveCamo");

            PowerUp Camouflage = new PowerUp(this, CrewmanPositions[4], new List <TileRef>()
            {
                new TileRef(12, 4, 0),
            }, 64, 64, 0f, (float)CamoSound.Duration.TotalSeconds, PowerUp.PowerUpType.Camouflage, 0, 0,
                                             Content.Load <SoundEffect>(@"audio/Rescue4"), CamoSound, null);

            List <PowerUp> TankCrewmen = new List <PowerUp>()
            {
                Speed, Regen, DefenseBoost, ExtraDamage, Camouflage
            };

            Services.AddService(TankCrewmen);
            #endregion

            #region Add Crosshairs
            new Crosshair(this, new Vector2(0, 0), new List <TileRef>()
            {
                new TileRef(10, 3, 0),
            }, 64, 64, 0f);
            new MouseCrosshair(this, new Vector2(0, 0), new List <TileRef>()
            {
                new TileRef(11, 3, 0),
            }, 64, 64, 0f);
            #endregion

            #region Set Collisions
            Services.AddService(Colliders);
            SetCollider(TileType.DIRT);
            SetCollider(TileType.METAL);
            SetTrigger(TileType.DIRT2); // For WIN condition
            #endregion

            base.Initialize();
        }