Exemplo n.º 1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            souris.UpdateMouse();
            clavier.UpdateKeyboard();
            manette.UpdateGamepad();

            // MUSIQUE
            #region musique menu
            if (status == "Principal" || status == "Choix_Niveau" || status == "Cinematiques" || status == "Jouer" || status == "Multi" || status == "Options" || status == "Video" || status == "Audio" || status == "Commandes" || status == "Langues")
            {
                if (MediaPlayer.State == MediaState.Stopped)
                {
                    MediaPlayer.Play(sonprincipal);
                }
            }
            #endregion

            // JEU
            #region update jeu
            if (status == "Jeu")
            {
                this.IsMouseVisible = false;

                joueur.Update(Window.ClientBounds.Height, Window.ClientBounds.Width, gameTime);
                //map.Update(joueur);

                List<Zombie> todelete = new List<Zombie>();
                foreach (Zombie z in zombie)
                {
                    if (!z.GetDead())
                    {
                        z.SetMarche();
                        z.Move(joueur, zombie, gameTime.ElapsedGameTime.Milliseconds, Window.ClientBounds.Height, Window.ClientBounds.Width);
                        z.SetAngleVisee(joueur.GetRectangleCenter());
                        z.SetVisee();
                    }
                    else
                    {
                        todelete.Add(z);
                    }
                }

                foreach (Zombie z in todelete)
                    zombie.Remove(z);

                elapsedtime += gameTime.ElapsedGameTime.Milliseconds;

                if (elapsedtime / difficulté.GetMilliseconds() > nombre_zombie && nombre_zombie < difficulté.GetMaxZombies())
                {
                    zombie.Add(Zombie.SpawnZombie(Window.ClientBounds.Width, Window.ClientBounds.Height, Content, difficulté.GetMaxSpeed()));
                    nombre_zombie += 1;
                }

                if (nombre_zombie == difficulté.GetMaxZombies() && zombie.Count == 0)
                {
                    status = "Fin_victoire";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

                if (joueur.GetHealth() <= 0)
                {
                    status = "Fin_mort";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
            }
            #endregion

            // FIN MORT
            #region fin mort
            if (status == "Fin_mort")
            {
                joueur.Save("solo.save");
                this.IsMouseVisible = true;
                Bretour.SetPosition(new Vector2((Window.ClientBounds.Width - Bretour.GetTexturefr().Width) / 2, (Window.ClientBounds.Height - Bretour.GetTexturefr().Height) / 2 + 50));
                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 2 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)) || (clavier_old.KeyPressed(Keys.Escape) && !clavier.KeyPressed(Keys.Escape)))
                {
                    gestionclavier = -1;
                    status = "Principal";
                }
            }
            #endregion

            // FIN VICTOIRE
            #region fin victoire
            if (status == "Fin_victoire")
            {
                joueur.Save("solo.save");
                this.IsMouseVisible = true;
                Bretour.SetPosition(new Vector2((Window.ClientBounds.Width - Bretour.GetTexturefr().Width) / 2, (Window.ClientBounds.Height - Bretour.GetTexturefr().Height) / 2 + 50));
                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 2 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)) || (clavier_old.KeyPressed(Keys.Escape) && !clavier.KeyPressed(Keys.Escape)))
                {
                    gestionclavier = -1;
                    status = "Principal";
                }
            }
            #endregion

            // MAGASIN
            #region magasin
            if (status == "Magasin")
            {
                this.IsMouseVisible = true;
                Bquitter.SetPosition(new Vector2(Window.ClientBounds.Width - 2 * Bcontinuer.GetTexturefr().Width, Window.ClientBounds.Height - 3 * Bcontinuer.GetTexturefr().Height));
                Busp.SetPosition(new Vector2(Bcontinuer.GetTexturefr().Width, 3 * Bcontinuer.GetTexturefr().Height));
                Bm3.SetPosition(new Vector2(Bcontinuer.GetTexturefr().Width, 4 * Bcontinuer.GetTexturefr().Height));
                Bmp5.SetPosition(new Vector2(Bcontinuer.GetTexturefr().Width, 5 * Bcontinuer.GetTexturefr().Height));
                Bak47.SetPosition(new Vector2(Bcontinuer.GetTexturefr().Width, 6 * Bcontinuer.GetTexturefr().Height));
                Bshit.SetPosition(new Vector2((5 / 2) * Bcontinuer.GetTexturefr().Width + 2 * Bak47.GetTexturefr().Width, 3 * Bcontinuer.GetTexturefr().Height));
                Bcoke.SetPosition(new Vector2((5 / 2) * Bcontinuer.GetTexturefr().Width + 2 * Bak47.GetTexturefr().Width, 4 * Bcontinuer.GetTexturefr().Height));
                Bseringue.SetPosition(new Vector2((5 / 2) * Bcontinuer.GetTexturefr().Width + 2 * Bak47.GetTexturefr().Width, 5 * Bcontinuer.GetTexturefr().Height));

                if ((souris.GetRectangle().Intersects(Bquitter.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick()) || (!clavier.KeyPressed(Keys.X) && clavier_old.KeyPressed(Keys.X)) || (!manette.IsPressed(Buttons.Back) && manette_old.IsPressed(Buttons.Back)))
                {
                    status = "Jeu";
                }

                //ARMES
                if (souris.GetRectangle().Intersects(Busp.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    status = "USP UNLOCKED";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if (souris.GetRectangle().Intersects(Bm3.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (joueur.GetWeapons("m3").unlocked == false)
                        status = "M3";
                    else
                        status = "M3 UNLOCKED";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if (souris.GetRectangle().Intersects(Bmp5.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (joueur.GetWeapons("mp5").unlocked == false)
                        status = "MP5";
                    else
                        status = "MP5 UNLOCKED";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if (souris.GetRectangle().Intersects(Bak47.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (joueur.GetWeapons("ak47").unlocked == false)
                        status = "AK47";
                    else
                        status = "AK47 UNLOCKED";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

                //SHIT
                if (souris.GetRectangle().Intersects(Bshit.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (joueur.GetMoney() >= 200 && joueur.GetHealth() < 100)
                    {
                        joueur.ChangeHealth("shit");
                    }
                }

                //COKE
                if (souris.GetRectangle().Intersects(Bcoke.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (joueur.GetMoney() >= 500 && joueur.GetHealth() < 100)
                    {
                        joueur.ChangeHealth("coke");
                    }
                }

                //SERINGUE
                if (souris.GetRectangle().Intersects(Bseringue.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (joueur.GetMoney() >= 1000 && joueur.GetHealth() < 100)
                    {
                        joueur.ChangeHealth("seringue");
                    }
                }
            }

            //USP UNLOCKED
            #region usp

            if (status == "USP UNLOCKED")
            {
                this.IsMouseVisible = true;

                Bm3.SetPosition(new Vector2(Bcontinuer.GetTexturefr().Width, 2 * Bcontinuer.GetTexturefr().Height));
                Bameliorer.SetPosition(new Vector2(Window.ClientBounds.Width / 2 + Bcontinuer.GetTexturefr().Width / 3, Window.ClientBounds.Height / 2 - Bcontinuer.GetTexturefr().Height / 2));
                Bmunitions.SetPosition(new Vector2(Window.ClientBounds.Width / 2 - Bcontinuer.GetTexturefr().Width, Window.ClientBounds.Height / 2 - Bcontinuer.GetTexturefr().Height / 2));
                Bretour.SetPosition(new Vector2(Window.ClientBounds.Width - 2 * Bcontinuer.GetTexturefr().Width, Window.ClientBounds.Height - 3 * Bcontinuer.GetTexturefr().Height));

                if (souris.GetRectangle().Intersects(Bameliorer.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (joueur.GetWeapons("usp").GetLevel() == 1 && joueur.GetMoney() >= 1000)
                    {
                        joueur.GetWeapons("usp").AddLevel();
                        joueur.SetMoney(-1000);
                        prix_amelio_usp = "2000 $";

                        joueur.Save("solo.save");
                    }
                    else
                        if (joueur.GetWeapons("usp").GetLevel() == 2 && joueur.GetMoney() >= 2000)
                        {
                            joueur.GetWeapons("usp").AddLevel();
                            joueur.SetMoney(-2000);
                            prix_amelio_usp = "3000 $";

                            joueur.Save("solo.save");
                        }
                        else
                            if (joueur.GetWeapons("usp").GetLevel() == 3 && joueur.GetMoney() >= 3000)
                            {
                                joueur.GetWeapons("usp").AddLevel();
                                joueur.SetMoney(-3000);
                                prix_amelio_usp = "4000 $";

                                joueur.Save("solo.save");
                            }
                            else
                                if (joueur.GetWeapons("usp").GetLevel() == 4 && joueur.GetMoney() >= 4000)
                                {
                                    joueur.GetWeapons("usp").AddLevel();
                                    joueur.SetMoney(-4000);
                                    prix_amelio_usp = "5000 $";

                                    joueur.Save("solo.save");
                                }
                                else
                                    if (joueur.GetWeapons("usp").GetLevel() == 5 && joueur.GetMoney() >= 5000)
                                    {
                                        joueur.GetWeapons("usp").AddLevel();
                                        joueur.SetMoney(-5000);
                                        prix_amelio_usp = "";

                                        joueur.Save("solo.save");
                                    }
                }

                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    status = "Magasin";
                }
            }

            #endregion

            //M3
            #region m3
            if (status == "M3")
            {
                this.IsMouseVisible = true;
                Bm3.SetPosition(new Vector2(Bcontinuer.GetTexturefr().Width, 2 * Bcontinuer.GetTexturefr().Height));
                Bacheter.SetPosition(new Vector2(Window.ClientBounds.Width / 2 - Bcontinuer.GetTexturefr().Width / 2, Window.ClientBounds.Height / 2 - Bcontinuer.GetTexturefr().Height / 2));
                Bretour.SetPosition(new Vector2(Window.ClientBounds.Width - 2 * Bcontinuer.GetTexturefr().Width, Window.ClientBounds.Height - 3 * Bcontinuer.GetTexturefr().Height));

                if (souris.GetRectangle().Intersects(Bacheter.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (joueur.GetMoney() >= 5000)
                    {
                        status = "M3 UNLOCKED";
                        joueur.GetWeapons("m3").unlocked = true;
                        joueur.Debloque_Weapon(joueur.GetWeapons("m3"));
                        souris_old = new MouseEvent();
                        clavier_old = new KeyboardEvent();

                        joueur.Save("solo.save");
                    }
                }
                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    status = "Magasin";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
            }
            #endregion

            //M3 UNLOCKED
            #region m3 unlocked
            if (status == "M3 UNLOCKED")
            {
                this.IsMouseVisible = true;

                Bm3.SetPosition(new Vector2(Bcontinuer.GetTexturefr().Width, 2 * Bcontinuer.GetTexturefr().Height));
                Bameliorer.SetPosition(new Vector2(Window.ClientBounds.Width / 2 + Bcontinuer.GetTexturefr().Width / 3, Window.ClientBounds.Height / 2 - Bcontinuer.GetTexturefr().Height / 2));
                Bmunitions.SetPosition(new Vector2(Window.ClientBounds.Width / 2 - Bcontinuer.GetTexturefr().Width, Window.ClientBounds.Height / 2 - Bcontinuer.GetTexturefr().Height / 2));
                Bretour.SetPosition(new Vector2(Window.ClientBounds.Width - 2 * Bcontinuer.GetTexturefr().Width, Window.ClientBounds.Height - 3 * Bcontinuer.GetTexturefr().Height));

                if (souris.GetRectangle().Intersects(Bameliorer.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (joueur.GetWeapons("m3").GetLevel() == 1 && joueur.GetMoney() >= 1500)
                    {
                        joueur.GetWeapons("m3").AddLevel();
                        joueur.SetMoney(-1500);
                        prix_amelio_m3 = "2000 $";

                        joueur.Save("solo.save");
                    }
                    else
                        if (joueur.GetWeapons("m3").GetLevel() == 2 && joueur.GetMoney() >= 2000)
                        {
                            joueur.GetWeapons("m3").AddLevel();
                            joueur.SetMoney(-2000);
                            prix_amelio_m3 = "4000 $";

                            joueur.Save("solo.save");
                        }
                        else
                            if (joueur.GetWeapons("m3").GetLevel() == 3 && joueur.GetMoney() >= 4000)
                            {
                                joueur.GetWeapons("m3").AddLevel();
                                joueur.SetMoney(-4000);
                                prix_amelio_m3 = "8000 $";

                                joueur.Save("solo.save");
                            }
                            else
                                if (joueur.GetWeapons("m3").GetLevel() == 4 && joueur.GetMoney() >= 8000)
                                {
                                    joueur.GetWeapons("m3").AddLevel();
                                    joueur.SetMoney(-8000);
                                    prix_amelio_m3 = "10000 $";

                                    joueur.Save("solo.save");
                                }
                                else
                                    if (joueur.GetWeapons("m3").GetLevel() == 5 && joueur.GetMoney() >= 10000)
                                    {
                                        joueur.GetWeapons("m3").AddLevel();
                                        joueur.SetMoney(-10000);
                                        prix_amelio_m3 = "";

                                        joueur.Save("solo.save");
                                    }
                }

                if (souris.GetRectangle().Intersects(Bmunitions.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() && joueur.GetWeapons("m3").ammo <= joueur.GetWeapons("m3").ammo_max)
                {
                    if (joueur.GetMoney() >= 500)
                    {
                        joueur.GetWeapons("m3").ammo = joueur.GetWeapons("m3").ammo_max;
                    }
                }

                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    status = "Magasin";
                }
            }
            #endregion

            //MP5
            #region mp5
            if (status == "MP5")
            {
                this.IsMouseVisible = true;
                Bmp5.SetPosition(new Vector2(Bcontinuer.GetTexturefr().Width, 2 * Bcontinuer.GetTexturefr().Height));
                Bacheter.SetPosition(new Vector2(Window.ClientBounds.Width / 2 - Bcontinuer.GetTexturefr().Width / 2, Window.ClientBounds.Height / 2 - Bcontinuer.GetTexturefr().Height / 2));
                Bretour.SetPosition(new Vector2(Window.ClientBounds.Width - 2 * Bcontinuer.GetTexturefr().Width, Window.ClientBounds.Height - 3 * Bcontinuer.GetTexturefr().Height));

                if (souris.GetRectangle().Intersects(Bacheter.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (joueur.GetMoney() >= 10000)
                    {
                        status = "MP5 UNLOCKED";
                        joueur.GetWeapons("mp5").unlocked = true;
                        joueur.Debloque_Weapon(joueur.GetWeapons("mp5"));

                        joueur.Save("solo.save");
                    }
                }

                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    status = "Magasin";
                }
            }
            #endregion

            //MP5 UNLOCKED
            #region mp5 unlocked
            if (status == "MP5 UNLOCKED")
            {
                this.IsMouseVisible = true;
                Bmp5.SetPosition(new Vector2(Bcontinuer.GetTexturefr().Width, 2 * Bcontinuer.GetTexturefr().Height));
                Bameliorer.SetPosition(new Vector2(Window.ClientBounds.Width / 2 + Bcontinuer.GetTexturefr().Width / 3, Window.ClientBounds.Height / 2 - Bcontinuer.GetTexturefr().Height / 2));
                Bmunitions.SetPosition(new Vector2(Window.ClientBounds.Width / 2 - Bcontinuer.GetTexturefr().Width, Window.ClientBounds.Height / 2 - Bcontinuer.GetTexturefr().Height / 2));
                Bretour.SetPosition(new Vector2(Window.ClientBounds.Width - 2 * Bcontinuer.GetTexturefr().Width, Window.ClientBounds.Height - 3 * Bcontinuer.GetTexturefr().Height));

                if (souris.GetRectangle().Intersects(Bameliorer.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (joueur.GetWeapons("mp5").GetLevel() == 1 && joueur.GetMoney() >= 2000)
                    {
                        joueur.GetWeapons("mp5").AddLevel();
                        joueur.SetMoney(-2000);
                        prix_amelio_mp5 = "3000 $";

                        joueur.Save("solo.save");
                    }
                    else
                        if (joueur.GetWeapons("mp5").GetLevel() == 2 && joueur.GetMoney() >= 3000)
                        {
                            joueur.GetWeapons("mp5").AddLevel();
                            joueur.SetMoney(-3000);
                            prix_amelio_mp5 = "5000 $";

                            joueur.Save("solo.save");
                        }
                        else
                            if (joueur.GetWeapons("mp5").GetLevel() == 3 && joueur.GetMoney() >= 5000)
                            {
                                joueur.GetWeapons("mp5").AddLevel();
                                joueur.SetMoney(-5000);
                                prix_amelio_mp5 = "10000 $";

                                joueur.Save("solo.save");
                            }
                            else
                                if (joueur.GetWeapons("mp5").GetLevel() == 4 && joueur.GetMoney() >= 10000)
                                {
                                    joueur.GetWeapons("mp5").AddLevel();
                                    joueur.SetMoney(-10000);
                                    prix_amelio_mp5 = "15000 $";

                                    joueur.Save("solo.save");
                                }
                                else
                                    if (joueur.GetWeapons("mp5").GetLevel() == 5 && joueur.GetMoney() >= 15000)
                                    {
                                        joueur.GetWeapons("mp5").AddLevel();
                                        joueur.SetMoney(-15000);
                                        prix_amelio_mp5 = "";

                                        joueur.Save("solo.save");
                                    }
                }

                if (souris.GetRectangle().Intersects(Bmunitions.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() && joueur.GetWeapons("mp5").ammo <= joueur.GetWeapons("mp5").ammo_max)
                {
                    if (joueur.GetMoney() >= 500)
                    {
                        joueur.GetWeapons("mp5").ammo = joueur.GetWeapons("mp5").ammo_max;
                    }
                }

                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    status = "Magasin";
                }
            }
            #endregion

            //AK47
            #region ak47
            if (status == "AK47")
            {
                this.IsMouseVisible = true;

                Bak47.SetPosition(new Vector2(Bcontinuer.GetTexturefr().Width, 2 * Bcontinuer.GetTexturefr().Height));
                Bacheter.SetPosition(new Vector2(Window.ClientBounds.Width / 2 - Bcontinuer.GetTexturefr().Width / 2, Window.ClientBounds.Height / 2 - Bcontinuer.GetTexturefr().Height / 2));
                Bretour.SetPosition(new Vector2(Window.ClientBounds.Width - 2 * Bcontinuer.GetTexturefr().Width, Window.ClientBounds.Height - 3 * Bcontinuer.GetTexturefr().Height));

                if (souris.GetRectangle().Intersects(Bacheter.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (joueur.GetMoney() >= 50000)
                    {
                        status = "AK47 UNLOCKED";
                        joueur.GetWeapons("ak47").unlocked = true;
                        joueur.Debloque_Weapon(joueur.GetWeapons("ak47"));

                        joueur.Save("solo.save");
                    }
                }
                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    status = "Magasin";
                }
            }
            #endregion

            //AK47 UNLOCKED
            #region ak47 unlocked
            if (status == "AK47 UNLOCKED")
            {
                this.IsMouseVisible = true;

                Bak47.SetPosition(new Vector2(Bcontinuer.GetTexturefr().Width, 2 * Bcontinuer.GetTexturefr().Height));
                Bameliorer.SetPosition(new Vector2(Window.ClientBounds.Width / 2 + Bcontinuer.GetTexturefr().Width / 3, Window.ClientBounds.Height / 2 - Bcontinuer.GetTexturefr().Height / 2));
                Bmunitions.SetPosition(new Vector2(Window.ClientBounds.Width / 2 - Bcontinuer.GetTexturefr().Width, Window.ClientBounds.Height / 2 - Bcontinuer.GetTexturefr().Height / 2));
                Bretour.SetPosition(new Vector2(Window.ClientBounds.Width - 2 * Bcontinuer.GetTexturefr().Width, Window.ClientBounds.Height - 3 * Bcontinuer.GetTexturefr().Height));

                if (souris.GetRectangle().Intersects(Bameliorer.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (joueur.GetWeapons("ak47").GetLevel() == 1 && joueur.GetMoney() >= 3000)
                    {
                        joueur.GetWeapons("ak47").AddLevel();
                        joueur.SetMoney(-3000);
                        prix_amelio_ak47 = "5000 $";

                        joueur.Save("solo.save");
                    }
                    else
                        if (joueur.GetWeapons("ak47").GetLevel() == 2 && joueur.GetMoney() >= 5000)
                        {
                            joueur.GetWeapons("ak47").AddLevel();
                            joueur.SetMoney(-5000);
                            prix_amelio_ak47 = "10000 $";

                            joueur.Save("solo.save");
                        }
                        else
                            if (joueur.GetWeapons("ak47").GetLevel() == 3 && joueur.GetMoney() >= 10000)
                            {
                                joueur.GetWeapons("ak47").AddLevel();
                                joueur.SetMoney(-10000);
                                prix_amelio_ak47 = "15000 $";

                                joueur.Save("solo.save");
                            }
                            else
                                if (joueur.GetWeapons("ak47").GetLevel() == 4 && joueur.GetMoney() >= 15000)
                                {
                                    joueur.GetWeapons("ak47").AddLevel();
                                    joueur.SetMoney(-15000);
                                    prix_amelio_ak47 = "20000 $";

                                    joueur.Save("solo.save");
                                }
                                else
                                    if (joueur.GetWeapons("ak47").GetLevel() == 5 && joueur.GetMoney() >= 20000)
                                    {
                                        joueur.GetWeapons("ak47").AddLevel();
                                        joueur.SetMoney(-20000);
                                        prix_amelio_ak47 = "";

                                        joueur.Save("solo.save");
                                    }
                }

                if (souris.GetRectangle().Intersects(Bmunitions.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() && joueur.GetWeapons("ak47").ammo <= joueur.GetWeapons("ak47").ammo_max)
                {
                    if (joueur.GetMoney() >= 500)
                    {
                        joueur.GetWeapons("ak47").ammo = joueur.GetWeapons("ak47").ammo_max;
                    }
                }

                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    status = "Magasin";
                }
            }
            #endregion

            #endregion

            // MENU PRINCIPAL
            #region menu principal
            if (status == "Principal")
            {

                Bjouer.SetPosition(positionBoutton1);
                Bmulti.SetPosition(positionBoutton2);
                Boptions.SetPosition(positionBoutton3);
                Bquitter.SetPosition(positionBoutton4);

                if ((souris.GetRectangle().Intersects(Bjouer.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick()) || (gestionclavier == 0 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Jouer";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if ((souris.GetRectangle().Intersects(Bmulti.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick()) || (gestionclavier == 1 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Multi";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if ((souris.GetRectangle().Intersects(Boptions.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick()) || (gestionclavier == 2 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Options";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if ((souris.GetRectangle().Intersects(Bquitter.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick()) || (gestionclavier == 3 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    this.Exit();
                }

                if (!clavier.KeyPressed(Keys.Down) && clavier_old.KeyPressed(Keys.Down))
                {
                    if (gestionclavier < 3)
                        gestionclavier += 1;
                    else
                        gestionclavier = 0;
                }
                if (!clavier.KeyPressed(Keys.Up) && clavier_old.KeyPressed(Keys.Up))
                {
                    if (gestionclavier > 0)
                        gestionclavier -= 1;
                    else
                        gestionclavier = 3;
                }

                if (souris.GetRectangle().Intersects(Bjouer.GetRectangle()) || souris.GetRectangle().Intersects(Bmulti.GetRectangle()) || souris.GetRectangle().Intersects(Boptions.GetRectangle()) || souris.GetRectangle().Intersects(Bquitter.GetRectangle()))
                    gestionclavier = -1;

            }
            #endregion

            // MENU JOUER
            #region menu jouer
            if (status == "Jouer")
            {
                Bnouveaujeu.SetPosition(positionBoutton1);
                Bcontinuer.SetPosition(positionBoutton2);
                // vide
                Bretour.SetPosition(positionBoutton4);

                if (souris.GetRectangle().Intersects(Bnouveaujeu.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 0 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Choix_Niveau";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if (souris.GetRectangle().Intersects(Bcontinuer.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 1 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    if (zombie != null)
                    {
                        gestionclavier = -1;
                        status = "Jeu";
                        souris_old = new MouseEvent();
                        clavier_old = new KeyboardEvent();
                    }
                }
                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 2 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)) || (clavier_old.KeyPressed(Keys.Escape) && !clavier.KeyPressed(Keys.Escape)))
                {
                    gestionclavier = -1;
                    status = "Principal";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

                if (!clavier.KeyPressed(Keys.Down) && clavier_old.KeyPressed(Keys.Down))
                {
                    if (gestionclavier < 2)
                        gestionclavier += 1;
                    else
                        gestionclavier = 0;
                }
                if (!clavier.KeyPressed(Keys.Up) && clavier_old.KeyPressed(Keys.Up))
                {
                    if (gestionclavier > 0)
                        gestionclavier -= 1;
                    else
                        gestionclavier = 2;
                }

                if (souris.GetRectangle().Intersects(Bnouveaujeu.GetRectangle()) || souris.GetRectangle().Intersects(Bcontinuer.GetRectangle()) || souris.GetRectangle().Intersects(Bretour.GetRectangle()))
                    gestionclavier = -1;

            }
            #endregion

            // MENU CHOIX NIVEAU
            #region choix niveau
            if (status == "Choix_Niveau")
            {
                Bfacile.SetPosition(positionBoutton1);
                BIntermediaire.SetPosition(positionBoutton2);
                Bdifficle.SetPosition(positionBoutton3);
                Bimpossible.SetPosition(positionBoutton4);
                Bretour.SetPosition(positionBoutton5);

                if (souris.GetRectangle().Intersects(Bfacile.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 0 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Cinematiques";
                    diff = 1;
                }
                if (souris.GetRectangle().Intersects(BIntermediaire.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 1 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Cinematiques";
                    diff = 2;
                }
                if (souris.GetRectangle().Intersects(Bdifficle.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 2 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Cinematiques";
                    diff = 3;
                }
                if (souris.GetRectangle().Intersects(Bimpossible.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 3 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Cinematiques";
                    diff = 4;
                }
                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 4 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)) || (clavier_old.KeyPressed(Keys.Escape) && !clavier.KeyPressed(Keys.Escape)))
                {
                    gestionclavier = -1;
                    status = "Jouer";
                }

                elapsedtime = 1;

                if (!clavier.KeyPressed(Keys.Down) && clavier_old.KeyPressed(Keys.Down))
                {
                    if (gestionclavier < 4)
                        gestionclavier += 1;
                    else
                        gestionclavier = 0;
                }
                if (!clavier.KeyPressed(Keys.Up) && clavier_old.KeyPressed(Keys.Up))
                {
                    if (gestionclavier > 0)
                        gestionclavier -= 1;
                    else
                        gestionclavier = 4;
                }

                if (souris.GetRectangle().Intersects(Bfacile.GetRectangle()) || souris.GetRectangle().Intersects(BIntermediaire.GetRectangle()) || souris.GetRectangle().Intersects(Bdifficle.GetRectangle()) || souris.GetRectangle().Intersects(Bimpossible.GetRectangle()) || souris.GetRectangle().Intersects(Bretour.GetRectangle()))
                    gestionclavier = -1;
            }
            #endregion

            // CINEMATIQUES
            #region cinematiques
            if (status == "Cinematiques")
            {

                if (elapsedtime < 35000 && !clavier.KeyPressed(Keys.Enter))
                    elapsedtime += gameTime.ElapsedGameTime.Milliseconds;
                else
                {
                    difficulté = new Difficulté(diff);
                    status = "Nouveau_Jeu";
                }
            }
            #endregion

            // NOUVEAU JEU
            #region nouveau jeu
            if (status == "Nouveau_Jeu")
            {
                this.IsMouseVisible = false;
                MediaPlayer.Stop();
                joueur = new Joueur("solo.save", usp, ak47, mp5, m3, Content, Window.ClientBounds.Height, Window.ClientBounds.Width);
                zombie = new List<Zombie>();
                nombre_zombie = 0;
                elapsedtime = 1;
                status = "Jeu";

                map = new Map(1, Window.ClientBounds.Height, Window.ClientBounds.Width, Content);
            }
            #endregion

            // PAUSE
            #region pause
            if (status == "Pause")
            {
                Bcontinuer.SetPosition(new Vector2(Window.ClientBounds.Width / 2 - Bcontinuer.GetTexturefr().Width / 2 - Bcontinuer.GetTexturefr().Width, (Window.ClientBounds.Height - Bcontinuer.GetTexturefr().Height) / 2));
                Bquitter.SetPosition(new Vector2((Window.ClientBounds.Width / 2 - Bcontinuer.GetTexturefr().Width / 2 + Bcontinuer.GetTexturefr().Width), (Window.ClientBounds.Height - Bcontinuer.GetTexturefr().Height) / 2));

                if ((souris.GetRectangle().Intersects(Bcontinuer.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick()) || (!clavier.KeyPressed(Keys.Escape) && clavier_old.KeyPressed(Keys.Escape)) || (!manette.IsPressed(Buttons.Start) && manette_old.IsPressed(Buttons.Start)))
                {
                    status = "Jeu";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                    manette_old = new GamePadEvent(PlayerIndex.One);
                }
                if (souris.GetRectangle().Intersects(Bquitter.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    status = "Principal";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

            }
            #endregion

            // MULTI
            #region multi
            if (status == "Multi")
            {
                Bcreer.SetPosition(positionBoutton1);
                Brejoindre.SetPosition(positionBoutton2);
                // vide
                Bretour.SetPosition(positionBoutton4);

                if (souris.GetRectangle().Intersects(Bcreer.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 0 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    //status = "Creer";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if (souris.GetRectangle().Intersects(Brejoindre.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 1 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    //status = "Rejoindre";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 2 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)) || (clavier_old.KeyPressed(Keys.Escape) && !clavier.KeyPressed(Keys.Escape)))
                {
                    gestionclavier = -1;
                    status = "Principal";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

                if (!clavier.KeyPressed(Keys.Down) && clavier_old.KeyPressed(Keys.Down))
                {
                    if (gestionclavier < 2)
                        gestionclavier += 1;
                    else
                        gestionclavier = 0;
                }
                if (!clavier.KeyPressed(Keys.Up) && clavier_old.KeyPressed(Keys.Up))
                {
                    if (gestionclavier > 0)
                        gestionclavier -= 1;
                    else
                        gestionclavier = 2;
                }

                if (souris.GetRectangle().Intersects(Bcreer.GetRectangle()) || souris.GetRectangle().Intersects(Brejoindre.GetRectangle()) || souris.GetRectangle().Intersects(Bretour.GetRectangle()))
                    gestionclavier = -1;

            }
            #endregion

            // OPTIONS
            #region options
            if (status == "Options")
            {

                Bvideo.SetPosition(positionBoutton1);
                Baudio.SetPosition(positionBoutton2);
                Bjoueur.SetPosition(positionBoutton3);
                Bretour.SetPosition(positionBoutton4);

                if (souris.GetRectangle().Intersects(Bvideo.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 0 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Video";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if (souris.GetRectangle().Intersects(Baudio.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 1 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Audio";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if (souris.GetRectangle().Intersects(Bjoueur.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 2 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Options_joueur";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 3 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)) || (clavier_old.KeyPressed(Keys.Escape) && !clavier.KeyPressed(Keys.Escape)))
                {
                    gestionclavier = -1;
                    status = "Principal";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

                if (!clavier.KeyPressed(Keys.Down) && clavier_old.KeyPressed(Keys.Down))
                {
                    if (gestionclavier < 3)
                        gestionclavier += 1;
                    else
                        gestionclavier = 0;
                }
                if (!clavier.KeyPressed(Keys.Up) && clavier_old.KeyPressed(Keys.Up))
                {
                    if (gestionclavier > 0)
                        gestionclavier -= 1;
                    else
                        gestionclavier = 3;
                }

                if (souris.GetRectangle().Intersects(Bvideo.GetRectangle()) || souris.GetRectangle().Intersects(Baudio.GetRectangle()) || souris.GetRectangle().Intersects(Bcommandes.GetRectangle()) || souris.GetRectangle().Intersects(Bretour.GetRectangle()))
                    gestionclavier = -1;

            }
            #endregion

            // OPTIONS_JOUEUR
            #region options_joueur
            if (status == "Options_joueur")
            {

                Bnom.SetPosition(positionBoutton1);
                Bcommandes.SetPosition(positionBoutton2);
                Breset.SetPosition(positionBoutton3);
                Bretour.SetPosition(positionBoutton4);

                if (souris.GetRectangle().Intersects(Bnom.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 0 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Preset_nom";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if (souris.GetRectangle().Intersects(Bcommandes.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 1 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Commandes";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if (souris.GetRectangle().Intersects(Bjoueur.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 2 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Reset";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 3 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)) || (clavier_old.KeyPressed(Keys.Escape) && !clavier.KeyPressed(Keys.Escape)))
                {
                    gestionclavier = -1;
                    status = "Options";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

                if (!clavier.KeyPressed(Keys.Down) && clavier_old.KeyPressed(Keys.Down))
                {
                    if (gestionclavier < 3)
                        gestionclavier += 1;
                    else
                        gestionclavier = 0;
                }
                if (!clavier.KeyPressed(Keys.Up) && clavier_old.KeyPressed(Keys.Up))
                {
                    if (gestionclavier > 0)
                        gestionclavier -= 1;
                    else
                        gestionclavier = 3;
                }

                if (souris.GetRectangle().Intersects(Bvideo.GetRectangle()) || souris.GetRectangle().Intersects(Baudio.GetRectangle()) || souris.GetRectangle().Intersects(Bcommandes.GetRectangle()) || souris.GetRectangle().Intersects(Bretour.GetRectangle()))
                    gestionclavier = -1;

            }
            #endregion

            // SET_NOM
            #region set_nom
            if (status == "Preset_nom")
            {
                try
                {
                    set_nom = joueur.name;
                }
                catch
                {
                    set_nom = "Joueur";
                }
                status = "Set_nom";
            }

            if (status == "Set_nom")
            {
                Bretour.SetPosition(new Vector2(positionBoutton4.X - (int)(2.5f * Bretour.GetTexturefr().Width), positionBoutton4.Y));
                Bsave.SetPosition(positionBoutton4);

                if (souris.GetRectangle().Intersects(Bsave.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {

                    string[] temp = File.ReadAllLines("solo.save");
                    temp[0] = set_nom;
                    StreamWriter file = new StreamWriter("solo.save");
                    foreach (string s in temp)
                        file.WriteLine(s);
                    file.Close();

                    joueur.SetName(set_nom);

                    gestionclavier = -1;
                    status = "Options_joueur";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (clavier_old.KeyPressed(Keys.Escape) && !clavier.KeyPressed(Keys.Escape)))
                {
                    gestionclavier = -1;
                    status = "Options_joueur";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

                Keys[] keysToCheck = new Keys[] {
                    Keys.A, Keys.B, Keys.C, Keys.D, Keys.E,
                    Keys.F, Keys.G, Keys.H, Keys.I, Keys.J,
                    Keys.K, Keys.L, Keys.M, Keys.N, Keys.O,
                    Keys.P, Keys.Q, Keys.R, Keys.S, Keys.T,
                    Keys.U, Keys.V, Keys.W, Keys.X, Keys.Y,
                    Keys.Z, Keys.Back, Keys.Space };

                foreach (Keys key in keysToCheck)
                {
                    if (clavier_old.KeyPressed(key) && !clavier.KeyPressed(key))
                    {
                        if (set_nom.Length < 16)
                        {
                            switch (key)
                            {
                                case Keys.A:
                                    set_nom += "A";
                                    break;
                                case Keys.B:
                                    set_nom += "B";
                                    break;
                                case Keys.C:
                                    set_nom += "C";
                                    break;
                                case Keys.D:
                                    set_nom += "D";
                                    break;
                                case Keys.E:
                                    set_nom += "E";
                                    break;
                                case Keys.F:
                                    set_nom += "F";
                                    break;
                                case Keys.G:
                                    set_nom += "G";
                                    break;
                                case Keys.H:
                                    set_nom += "H";
                                    break;
                                case Keys.I:
                                    set_nom += "I";
                                    break;
                                case Keys.J:
                                    set_nom += "J";
                                    break;
                                case Keys.K:
                                    set_nom += "K";
                                    break;
                                case Keys.L:
                                    set_nom += "L";
                                    break;
                                case Keys.M:
                                    set_nom += "M";
                                    break;
                                case Keys.N:
                                    set_nom += "N";
                                    break;
                                case Keys.O:
                                    set_nom += "O";
                                    break;
                                case Keys.P:
                                    set_nom += "P";
                                    break;
                                case Keys.Q:
                                    set_nom += "Q";
                                    break;
                                case Keys.R:
                                    set_nom += "R";
                                    break;
                                case Keys.S:
                                    set_nom += "S";
                                    break;
                                case Keys.T:
                                    set_nom += "T";
                                    break;
                                case Keys.U:
                                    set_nom += "U";
                                    break;
                                case Keys.V:
                                    set_nom += "V";
                                    break;
                                case Keys.W:
                                    set_nom += "W";
                                    break;
                                case Keys.X:
                                    set_nom += "X";
                                    break;
                                case Keys.Y:
                                    set_nom += "Y";
                                    break;
                                case Keys.Z:
                                    set_nom += "Z";
                                    break;
                                case Keys.Space:
                                    set_nom += " ";
                                    break;
                            }
                        }

                        if (key == Keys.Back)
                        {
                            string temp = "";
                            for (int i = 0; i < set_nom.Length - 1; i++)
                            {
                                temp += set_nom[i];
                            }
                            set_nom = temp;
                        }

                    }
                }
            }
            #endregion

            // RESET
            #region reset
            if (status == "Reset")
            {
                Bretour.SetPosition(new Vector2((Window.ClientBounds.Width - Bretour.GetTextureen().Width) / 2, (Window.ClientBounds.Height - Bretour.GetTextureen().Height) / 2));

                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (clavier_old.KeyPressed(Keys.Escape) && !clavier.KeyPressed(Keys.Escape)))
                {
                    gestionclavier = -1;
                    status = "Options_joueur";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

                if (!clavier.KeyPressed(Keys.R) && clavier_old.KeyPressed(Keys.R))
                {
                    try
                    {
                        StreamWriter file = new StreamWriter("solo.save");
                        file.WriteLine("Joueur");
                        file.WriteLine("0");
                        file.WriteLine("0");
                        file.WriteLine("0");
                        file.WriteLine("0");
                        file.WriteLine("0");
                        file.WriteLine("0");
                        file.WriteLine("0");
                        file.WriteLine("0");
                        file.Close();
                        status = "Reset_done";
                    }
                    catch
                    {
                        status = "Reset_error";
                    }
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

                if (!clavier.KeyPressed(Keys.M) && clavier_old.KeyPressed(Keys.M))
                {
                    try
                    {
                        StreamWriter file = new StreamWriter("j1.save");
                        file.WriteLine("Joueur");
                        file.WriteLine("0");
                        file.WriteLine("0");
                        file.WriteLine("0");
                        file.WriteLine("0");
                        file.WriteLine("0");
                        file.WriteLine("0");
                        file.WriteLine("0");
                        file.WriteLine("0");
                        file.Close();

                        StreamWriter file2 = new StreamWriter("j2.save");
                        file2.WriteLine("Joueur");
                        file2.WriteLine("0");
                        file2.WriteLine("0");
                        file2.WriteLine("0");
                        file2.WriteLine("0");
                        file2.WriteLine("0");
                        file2.WriteLine("0");
                        file2.WriteLine("0");
                        file2.WriteLine("0");
                        file2.Close();

                        status = "Reset_done";
                    }
                    catch
                    {
                        status = "Reset_error";
                    }
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
            }

            if (status == "Reset_done" || status == "Reset_error")
            {
                Bretour.SetPosition(new Vector2((Window.ClientBounds.Width - Bretour.GetTextureen().Width) / 2, (Window.ClientBounds.Height - Bretour.GetTextureen().Height) / 2));

                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (clavier_old.KeyPressed(Keys.Escape) && !clavier.KeyPressed(Keys.Escape)))
                {
                    gestionclavier = -1;
                    status = "Options_joueur";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
            }

            #endregion

            // AUDIO
            #region audio
            if (status == "Audio")
            {
                Bmusique.SetPosition(new Vector2(positionBoutton1.X - (int)(1.5 * Bmusique.GetTexturefr().Width), positionBoutton1.Y));
                Bboxmusique.SetPosition(new Vector2(Bmusique.GetPosition().X - 40, positionBoutton1.Y + 8));
                Bmoinsmusic.SetPosition(new Vector2(Bmusique.GetPosition().X + 10 + Bmusique.GetTexturefr().Width, positionBoutton1.Y));
                Bplusmusic.SetPosition(new Vector2(Bmoinsmusic.GetPosition().X + 90 + Bmusique.GetTexturefr().Width, positionBoutton1.Y));

                Beffets.SetPosition(new Vector2(positionBoutton2.X - (int)(1.5 * Bmusique.GetTexturefr().Width), positionBoutton2.Y));
                Bboxeffects.SetPosition(new Vector2(Beffets.GetPosition().X - 40, positionBoutton2.Y + 8));
                Bmoinseffects.SetPosition(new Vector2(Bmusique.GetPosition().X + 10 + Bmusique.GetTexturefr().Width, positionBoutton2.Y));
                Bpluseffects.SetPosition(new Vector2(Bmoinsmusic.GetPosition().X + 90 + Bmusique.GetTexturefr().Width, positionBoutton2.Y));

                musicbar = new Rectangle((int)Bmoinsmusic.GetPosition().X + Bmoinsmusic.GetTexturefr().Width + 8, (int)Bmoinsmusic.GetPosition().Y + Bmoinsmusic.GetTexturefr().Height / 4, (int)(200 * (float)volumemusic / (float)10), Bmusique.GetTexturefr().Height / 2);
                effectsbar = new Rectangle((int)Bmoinsmusic.GetPosition().X + Bmoinsmusic.GetTexturefr().Width + 8, (int)Bmoinseffects.GetPosition().Y + Bmoinsmusic.GetTexturefr().Height / 4, (int)(200 * (float)volumeeffects / (float)10), Bmusique.GetTexturefr().Height / 2);

                Bretour.SetPosition(positionBoutton4);

                if (souris.GetRectangle().Intersects(Bmusique.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    musique = !musique;
                }
                if (souris.GetRectangle().Intersects(Bboxmusique.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    musique = !musique;
                }
                if (souris.GetRectangle().Intersects(Beffets.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    effets = !effets;
                }
                if (souris.GetRectangle().Intersects(Bboxeffects.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    effets = !effets;
                }

                //Volume du son
                if (souris.GetRectangle().Intersects(Bplusmusic.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (volumemusic < 10)
                        volumemusic += 1;
                    else
                        volumemusic = 10;
                }
                if (souris.GetRectangle().Intersects(Bmoinsmusic.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (volumemusic > 0)
                        volumemusic -= 1;
                    else
                        volumemusic = 0;
                }

                if (souris.GetRectangle().Intersects(Bpluseffects.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (volumeeffects < 10)
                        volumeeffects += 1;
                    else
                        volumeeffects = 10;
                }
                if (souris.GetRectangle().Intersects(Bmoinseffects.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    if (volumeeffects > 0)
                        volumeeffects -= 1;
                    else
                        volumeeffects = 0;
                }

                if (!musique)
                    volumemusic = 0;
                if (!effets)
                    volumeeffects = 0;

                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 0 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)) || (clique_back && !clavier.KeyPressed(Keys.Escape)))
                {
                    gestionclavier = -1;
                    status = "Options";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

                if (!clavier.KeyPressed(Keys.Down) && clavier_old.KeyPressed(Keys.Down))
                {
                    if (gestionclavier < 0)
                        gestionclavier += 1;
                    else
                        gestionclavier = 0;
                }
                if (!clavier.KeyPressed(Keys.Up) && clavier_old.KeyPressed(Keys.Up))
                {
                    if (gestionclavier > 0)
                        gestionclavier -= 1;
                    else
                        gestionclavier = 0;
                }

                if (souris.GetRectangle().Intersects(Bmusique.GetRectangle()) || souris.GetRectangle().Intersects(Bmoinsmusic.GetRectangle()) || souris.GetRectangle().Intersects(Bplusmusic.GetRectangle()) || souris.GetRectangle().Intersects(Beffets.GetRectangle()) || souris.GetRectangle().Intersects(Bmoinseffects.GetRectangle()) || souris.GetRectangle().Intersects(Bpluseffects.GetRectangle()) || souris.GetRectangle().Intersects(Bretour.GetRectangle()))
                    gestionclavier = -1;

                MediaPlayer.Volume = (float)volumemusic / 10f;
            }
            #endregion

            // VIDEO
            #region video
            if (status == "Video")
            {

                Blangue.SetPosition(positionBoutton1);
                Bfullscreen.SetPosition(positionBoutton2);
                Bfenetre.SetPosition(positionBoutton2);
                // vide
                Bretour.SetPosition(positionBoutton4);

                if (souris.GetRectangle().Intersects(Blangue.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 0 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    status = "Langues";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }
                if (souris.GetRectangle().Intersects(Bfullscreen.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 1 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    fullscreen = !fullscreen;
                    graphics.ToggleFullScreen();
                }
                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 2 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)) || (clavier_old.KeyPressed(Keys.Escape) && !clavier.KeyPressed(Keys.Escape)))
                {
                    gestionclavier = -1;
                    status = "Options";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

                if (!clavier.KeyPressed(Keys.Down) && clavier_old.KeyPressed(Keys.Down))
                {
                    if (gestionclavier < 2)
                        gestionclavier += 1;
                    else
                        gestionclavier = 0;
                }
                if (!clavier.KeyPressed(Keys.Up) && clavier_old.KeyPressed(Keys.Up))
                {
                    if (gestionclavier > 0)
                        gestionclavier -= 1;
                    else
                        gestionclavier = 2;
                }

                if (souris.GetRectangle().Intersects(Bnouveaujeu.GetRectangle()) || souris.GetRectangle().Intersects(Bcontinuer.GetRectangle()) || souris.GetRectangle().Intersects(Bretour.GetRectangle()))
                    gestionclavier = -1;

            }
            #endregion

            // LANGUES
            #region langues
            if (status == "Langues")
            {
                Blangueen.SetPosition(new Vector2(-10000));
                Blangueit.SetPosition(new Vector2(-10000));
                Blanguefr.SetPosition(new Vector2(-10000));
                Blanguede.SetPosition(new Vector2(-10000));
                if (lang == 1) //francais
                {
                    Blangueen.SetPosition(positionBoutton1);
                    Blangueit.SetPosition(positionBoutton2);
                    Blanguede.SetPosition(positionBoutton3);
                    Bretour.SetPosition(positionBoutton4);
                }
                if (lang == 2) //anglais
                {
                    Blanguefr.SetPosition(positionBoutton1);
                    Blangueit.SetPosition(positionBoutton2);
                    Blanguede.SetPosition(positionBoutton3);
                    Bretour.SetPosition(positionBoutton4);
                }
                if (lang == 3) //italien
                {
                    Blanguefr.SetPosition(positionBoutton1);
                    Blangueen.SetPosition(positionBoutton2);
                    Blanguede.SetPosition(positionBoutton3);
                    Bretour.SetPosition(positionBoutton4);
                }
                if (lang == 4) //allemand
                {
                    Blanguefr.SetPosition(positionBoutton1);
                    Blangueen.SetPosition(positionBoutton2);
                    Blangueit.SetPosition(positionBoutton3);
                    Bretour.SetPosition(positionBoutton4);
                }

                if (souris.GetRectangle().Intersects(Blanguefr.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 0 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    lang = 1;
                }
                if (souris.GetRectangle().Intersects(Blangueen.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 1 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    lang = 2;
                }
                if (souris.GetRectangle().Intersects(Blangueit.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 2 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    lang = 3;
                }
                if (souris.GetRectangle().Intersects(Blanguede.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 2 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    gestionclavier = -1;
                    lang = 4;
                }

                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 3 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)) || (clique_back && !clavier.KeyPressed(Keys.Escape)))
                {
                    status = "Video";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

                if (!clavier.KeyPressed(Keys.Down) && clavier_old.KeyPressed(Keys.Down))
                {
                    if (gestionclavier < 2)
                        gestionclavier += 1;
                    else
                        gestionclavier = 0;
                }
                if (!clavier.KeyPressed(Keys.Up) && clavier_old.KeyPressed(Keys.Up))
                {
                    if (gestionclavier > 0)
                        gestionclavier -= 1;
                    else
                        gestionclavier = 2;
                }

                if (souris.GetRectangle().Intersects(Bnouveaujeu.GetRectangle()) || souris.GetRectangle().Intersects(Bcontinuer.GetRectangle()) || souris.GetRectangle().Intersects(Bretour.GetRectangle()))
                    gestionclavier = -1;

            }
            #endregion

            // COMMANDES
            #region commandes
            if (status == "Commandes")
            {

                Bmanette.SetPosition(positionBoutton1);
                Bbox.SetPosition(new Vector2(Bmanette.GetPosition().X + Bmanette.GetTexturefr().Width + 20, positionBoutton1.Y));

                // vide
                Bretour.SetPosition(positionBoutton4);

                if (souris.GetRectangle().Intersects(Bmanette.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 0 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)))
                {
                    jeu_manette = !jeu_manette;
                }
                if (souris.GetRectangle().Intersects(Bbox.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick())
                {
                    jeu_manette = !jeu_manette;
                }
                if (souris.GetRectangle().Intersects(Bretour.GetRectangle()) && !souris.LeftClick() && souris_old.LeftClick() || (gestionclavier == 1 && !clavier.KeyPressed(Keys.Enter) && clavier_old.KeyPressed(Keys.Enter)) || (clique_back && !clavier.KeyPressed(Keys.Escape)))
                {
                    gestionclavier = -1;
                    status = "Options";
                    souris_old = new MouseEvent();
                    clavier_old = new KeyboardEvent();
                }

                if (!clavier.KeyPressed(Keys.Down) && clavier_old.KeyPressed(Keys.Down))
                {
                    if (gestionclavier < 1)
                        gestionclavier += 1;
                    else
                        gestionclavier = 0;
                }
                if (!clavier.KeyPressed(Keys.Up) && clavier_old.KeyPressed(Keys.Up))
                {
                    if (gestionclavier > 0)
                        gestionclavier -= 1;
                    else
                        gestionclavier = 1;
                }

                if (souris.GetRectangle().Intersects(Bnouveaujeu.GetRectangle()) || souris.GetRectangle().Intersects(Bcontinuer.GetRectangle()) || souris.GetRectangle().Intersects(Bretour.GetRectangle()))
                    gestionclavier = -1;

            }
            #endregion

            souris_old.UpdateMouse();
            clavier_old.UpdateKeyboard();
            manette_old.UpdateGamepad();

            base.Update(gameTime);
        }
Exemplo n.º 2
0
        public void MoveKeyboard(KeyboardEvent clavier, int height, int width, List<Zombie> zombies)
        {
            if (clavier.KeyPressed(Keys.Z))
                direction.Y = -1;
            if (clavier.KeyPressed(Keys.S))
                direction.Y = 1;
            if (clavier.KeyPressed(Keys.Q))
                direction.X = -1;
            if (clavier.KeyPressed(Keys.D))
                direction.X = 1;
            if (clavier.KeyPressed(Keys.S) == clavier.KeyPressed(Keys.Z))
                direction.Y = 0;
            if (clavier.KeyPressed(Keys.Q) == clavier.KeyPressed(Keys.D))
                direction.X = 0;

            // sprint
            if (clavier.KeyPressed(Keys.LeftShift))
                SetSpeed(4);
            else
                SetSpeed(2);

            //colission avec zombies
            foreach (Zombie z in zombies)
            {
                if (z != null && !z.GetDead())
                {
                    if (target.Intersects(z.GetTarget()))
                    {
                        //a gauche
                        if (target.X >= (z.GetTarget().X - target.Width) && target.X <= (z.GetTarget().X - target.Width + 5) && direction.X > 0)
                        {
                            direction.X = 0;
                        }
                        //a droite
                        if (target.X <= z.GetTarget().X + z.GetTarget().Width && target.X >= z.GetTarget().X + z.GetTarget().Width - 5 && direction.X < 0)
                        {
                            direction.X = 0;
                        }
                        //en haut
                        if (target.Y >= (z.GetTarget().Y - target.Height) && target.Y <= (z.GetTarget().Y - target.Height + 5) && direction.Y > 0)
                        {
                            direction.Y = 0;
                        }
                        //en bas
                        if (target.Y <= z.GetTarget().Y + z.GetTarget().Height && target.Y >= z.GetTarget().Y + z.GetTarget().Height - 5 && direction.Y < 0)
                        {
                            direction.Y = 0;
                        }
                    }
                }
            }

            Game1.map.Update(this);
            //SetPosition(position + (direction * speed) + Game1.map.GetDirection());

            /*if (position.Y + rectangle.Height >= height)
                position.Y = height - rectangle.Height;
            else
                if (position.Y <= 0)
                    position.Y = 0;

            if (position.X + rectangle.Width >= width)
                position.X = width - rectangle.Width;
            else
                if (position.X <= 0)
                    position.X = 0;*/

            SetRectangle();
            SetTarget();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            ////////////////////////////////////// VARIABLES ! //////////////////////////////////////////////////////
            #region variables
            status = "Principal";
            fullscreen = true;
            jeu_manette = true;

            nombre_zombie = 0;

            elapsedtime = 1;
            entiermanette = 1;
            lang = 2;
            last_molette = 0;

            //musique
            musique = true;
            effets = !musique;
            entiermusique = 1;
            entiereffets = 1;

            volumemusic = 2;
            volumeeffects = 2;

            souris = new MouseEvent();
            clavier = new KeyboardEvent();
            manette = new GamePadEvent(PlayerIndex.One);

            souris_old = new MouseEvent();
            clavier_old = new KeyboardEvent();
            manette_old = new GamePadEvent(PlayerIndex.One);

            gestionclavier = -1;

            sonprincipal = Content.Load<Song>("sonprincipal");

            #endregion

            ////////////////////////////////////// BOUTONS & IMAGES! ////////////////////////////////////////////////
            #region boutons et images
            backgroundmenu = Content.Load<Texture2D>("menuprincipal");

            menupause = Content.Load<Texture2D>("menupause");
            pausemenu = Content.Load<Texture2D>("pausemenu");
            menupausa = Content.Load<Texture2D>("menupausa");
            menupausede = Content.Load<Texture2D>("menupause-allemand");
            barreson = Content.Load<Texture2D>("barreson");
            contourson = Content.Load<Texture2D>("contourson");
            viseur = Content.Load<Texture2D>("viseur");

            magasin = Content.Load<Texture2D>("magasin");
            negozio = Content.Load<Texture2D>("negozio");
            shop = Content.Load<Texture2D>("shop");
            magasinde = Content.Load<Texture2D>("magasin-allemand");

            mortFR = Content.Load<Texture2D>("mortFR");
            mortEN = Content.Load<Texture2D>("mortEN");
            mortIT = Content.Load<Texture2D>("mortIT");
            mortDE = Content.Load<Texture2D>("mortDE");

            victoireFR = Content.Load<Texture2D>("victoireFR");
            victoireEN = Content.Load<Texture2D>("victoireEN");
            victoireIT = Content.Load<Texture2D>("victoireIT");
            victoireDE = Content.Load<Texture2D>("victoireDE");

            HUD_vie = Content.Load<Texture2D>("vie");
            HUD_usp = Content.Load<Texture2D>("hud_usp");
            HUD_ak = Content.Load<Texture2D>("hud_ak47");
            HUD_mp5 = Content.Load<Texture2D>("hud_mp5");
            HUD_m3 = Content.Load<Texture2D>("hud_m3");

            cinematique1 = Content.Load<Texture2D>("cinematique1");
            cinematique2 = Content.Load<Texture2D>("cinematique2");
            cinematique3 = Content.Load<Texture2D>("cinematique3");
            cinematique4 = Content.Load<Texture2D>("cinematique4");
            cinematique5 = Content.Load<Texture2D>("cinematique5");
            cinematique6 = Content.Load<Texture2D>("cinematique6");
            cinematique7 = Content.Load<Texture2D>("cinematique7");
            cinematiqueen1 = Content.Load<Texture2D>("cinematiqueen1");
            cinematiqueen2 = Content.Load<Texture2D>("cinematiqueen2");
            cinematiqueen3 = Content.Load<Texture2D>("cinematiqueen3");
            cinematiqueen4 = Content.Load<Texture2D>("cinematiqueen4");
            cinematiqueen5 = Content.Load<Texture2D>("cinematiqueen5");
            cinematiqueen6 = Content.Load<Texture2D>("cinematiqueen6");
            cinematiqueen7 = Content.Load<Texture2D>("cinematiqueen7");
            cinematiqueit1 = Content.Load<Texture2D>("cinematiqueit1");
            cinematiqueit2 = Content.Load<Texture2D>("cinematiqueit2");
            cinematiqueit3 = Content.Load<Texture2D>("cinematiqueit3");
            cinematiqueit4 = Content.Load<Texture2D>("cinematiqueit4");
            cinematiqueit5 = Content.Load<Texture2D>("cinematiqueit5");
            cinematiqueit6 = Content.Load<Texture2D>("cinematiqueit6");
            cinematiqueit7 = Content.Load<Texture2D>("cinematiqueit7");
            cinematique1de = Content.Load<Texture2D>("cinematique1de");
            cinematique2de = Content.Load<Texture2D>("cinematique2de");
            cinematique3de = Content.Load<Texture2D>("cinematique3de");
            cinematique4de = Content.Load<Texture2D>("cinematique4de");
            cinematique5de = Content.Load<Texture2D>("cinematique5de");
            cinematique6de = Content.Load<Texture2D>("cinematique6de");
            cinematique7de = Content.Load<Texture2D>("cinematique7de");

            // principal
            Bjouer = new MenuButton(Vector2.One, Content.Load<Texture2D>("jouer"), Content.Load<Texture2D>("play"), Content.Load<Texture2D>("jouerit"), Content.Load<Texture2D>("jouer-allemand"));
            Bmulti = new MenuButton(Vector2.One, Content.Load<Texture2D>("multijoueur"), Content.Load<Texture2D>("multiplayer"), Content.Load<Texture2D>("multijoueurit"), Content.Load<Texture2D>("multijoueur-allemand"));
            Boptions = new MenuButton(Vector2.One, Content.Load<Texture2D>("options"), Content.Load<Texture2D>("options"), Content.Load<Texture2D>("optionsit"), Content.Load<Texture2D>("options-allemand"));
            Bquitter = new MenuButton(Vector2.One, Content.Load<Texture2D>("quitter"), Content.Load<Texture2D>("exit"), Content.Load<Texture2D>("quitterit"), Content.Load<Texture2D>("quitter-allemand"));
            Bretour = new MenuButton(Vector2.One, Content.Load<Texture2D>("retour"), Content.Load<Texture2D>("back"), Content.Load<Texture2D>("retourit"), Content.Load<Texture2D>("retour-allemand"));

            // Jouer
            Bnouveaujeu = new MenuButton(Vector2.One, Content.Load<Texture2D>("nouveaujeu"), Content.Load<Texture2D>("newgame"), Content.Load<Texture2D>("nouveaujeuit"), Content.Load<Texture2D>("nouveaujeu-allemand"));
            Bcontinuer = new MenuButton(Vector2.One, Content.Load<Texture2D>("continuer"), Content.Load<Texture2D>("continue"), Content.Load<Texture2D>("continuerit"), Content.Load<Texture2D>("continuer-allemand"));

            //Modes
            Bfacile = new MenuButton(Vector2.One, Content.Load<Texture2D>("facile"), Content.Load<Texture2D>("easy"), Content.Load<Texture2D>("facile"), Content.Load<Texture2D>("facile-allemand"));
            BIntermediaire = new MenuButton(Vector2.One, Content.Load<Texture2D>("intermediaire"), Content.Load<Texture2D>("intermediate"), Content.Load<Texture2D>("intermedio"), Content.Load<Texture2D>("intermediaire-allemand"));
            Bdifficle = new MenuButton(Vector2.One, Content.Load<Texture2D>("difficile"), Content.Load<Texture2D>("difficult"), Content.Load<Texture2D>("difficile"), Content.Load<Texture2D>("difficile-allemand"));
            Bimpossible = new MenuButton(Vector2.One, Content.Load<Texture2D>("impossible"), Content.Load<Texture2D>("impossible"), Content.Load<Texture2D>("impossibile"), Content.Load<Texture2D>("impossible-allemand"));

            // Multi
            Bcreer = new MenuButton(Vector2.One, Content.Load<Texture2D>("créer"), Content.Load<Texture2D>("create"), Content.Load<Texture2D>("creerit"), Content.Load<Texture2D>("creer-allemand"));
            Brejoindre = new MenuButton(Vector2.One, Content.Load<Texture2D>("rejoindre"), Content.Load<Texture2D>("join"), Content.Load<Texture2D>("rejoindreit"), Content.Load<Texture2D>("rejoindre-allemand"));

            //Options
            Bvideo = new MenuButton(Vector2.One, Content.Load<Texture2D>("vidéo"), Content.Load<Texture2D>("video"), Content.Load<Texture2D>("video"), Content.Load<Texture2D>("video-allemand"));
            Baudio = new MenuButton(Vector2.One, Content.Load<Texture2D>("audio"), Content.Load<Texture2D>("audio"), Content.Load<Texture2D>("audio"), Content.Load<Texture2D>("audio-allemand"));
            Bcommandes = new MenuButton(Vector2.One, Content.Load<Texture2D>("commandes"), Content.Load<Texture2D>("controls"), Content.Load<Texture2D>("commandesit"), Content.Load<Texture2D>("commandes-allemand"));
            Bjoueur = new MenuButton(Vector2.One, Content.Load<Texture2D>("joueur"), Content.Load<Texture2D>("joueurEN"), Content.Load<Texture2D>("joueurIT"), Content.Load<Texture2D>("joueurDE"));
            Breset = new MenuButton(Vector2.One, Content.Load<Texture2D>("reset"), Content.Load<Texture2D>("resetEN"), Content.Load<Texture2D>("resetIT"), Content.Load<Texture2D>("reinitialiserDE"));
            Bnom = new MenuButton(Vector2.One, Content.Load<Texture2D>("nom"), Content.Load<Texture2D>("nomEN"), Content.Load<Texture2D>("nomIT"), Content.Load<Texture2D>("nomDE"));
            Bsave = new MenuButton(Vector2.One, Content.Load<Texture2D>("save"), Content.Load<Texture2D>("saveEN"), Content.Load<Texture2D>("saveIT"), Content.Load<Texture2D>("sauvegarderDE"));

            //Audio
            Bmusique = new MenuButton(Vector2.One, Content.Load<Texture2D>("musique"), Content.Load<Texture2D>("music"), Content.Load<Texture2D>("musica"), Content.Load<Texture2D>("musique-allemand"));
            Beffets = new MenuButton(Vector2.One, Content.Load<Texture2D>("effetssonores"), Content.Load<Texture2D>("soundeffects"), Content.Load<Texture2D>("effettisonori"), Content.Load<Texture2D>("effetssonores-allemand"));
            Bboxmusique = new MenuButton(Vector2.One, Content.Load<Texture2D>("checked"), Content.Load<Texture2D>("unchecked"), Content.Load<Texture2D>("unchecked"), Content.Load<Texture2D>("unchecked"));
            Bboxeffects = new MenuButton(Vector2.One, Content.Load<Texture2D>("checked"), Content.Load<Texture2D>("unchecked"), Content.Load<Texture2D>("unchecked"), Content.Load<Texture2D>("unchecked"));
            Bmoinsmusic = new MenuButton(Vector2.One, Content.Load<Texture2D>("moins"), Content.Load<Texture2D>("moins"), Content.Load<Texture2D>("moins"), Content.Load<Texture2D>("moins"));
            Bplusmusic = new MenuButton(Vector2.One, Content.Load<Texture2D>("plus"), Content.Load<Texture2D>("plus"), Content.Load<Texture2D>("plus"), Content.Load<Texture2D>("plus"));
            Bmoinseffects = new MenuButton(Vector2.One, Content.Load<Texture2D>("moins"), Content.Load<Texture2D>("moins"), Content.Load<Texture2D>("moins"), Content.Load<Texture2D>("moins"));
            Bpluseffects = new MenuButton(Vector2.One, Content.Load<Texture2D>("plus"), Content.Load<Texture2D>("plus"), Content.Load<Texture2D>("plus"), Content.Load<Texture2D>("plus"));

            // Video
            Blangue = new MenuButton(Vector2.One, Content.Load<Texture2D>("langues"), Content.Load<Texture2D>("languages"), Content.Load<Texture2D>("languesit"), Content.Load<Texture2D>("langues-allemand"));
            Bfullscreen = new MenuButton(Vector2.One, Content.Load<Texture2D>("pleinecran"), Content.Load<Texture2D>("fullscreen"), Content.Load<Texture2D>("pleinecranit"), Content.Load<Texture2D>("pleinecran-allemand"));
            Bfenetre = new MenuButton(Vector2.One, Content.Load<Texture2D>("fenetre"), Content.Load<Texture2D>("windowed"), Content.Load<Texture2D>("fenetreit"), Content.Load<Texture2D>("fenetre-allemand"));

            //Langues
            Blanguefr = new MenuButton(Vector2.One, Content.Load<Texture2D>("french"), Content.Load<Texture2D>("french"), Content.Load<Texture2D>("francaisit"), Content.Load<Texture2D>("francais-allemand"));
            Blangueen = new MenuButton(Vector2.One, Content.Load<Texture2D>("anglais"), Content.Load<Texture2D>("anglaisit"), Content.Load<Texture2D>("anglaisit"), Content.Load<Texture2D>("anglais-allemand"));
            Blangueit = new MenuButton(Vector2.One, Content.Load<Texture2D>("italien"), Content.Load<Texture2D>("italian"), Content.Load<Texture2D>("anglaisit"), Content.Load<Texture2D>("italien-allemand"));
            Blanguede = new MenuButton(Vector2.One, Content.Load<Texture2D>("italien"), Content.Load<Texture2D>("italian"), Content.Load<Texture2D>("anglaisit"), Content.Load<Texture2D>("italien-allemand"));

            // Commandes
            Bmanette = new MenuButton(Vector2.One, Content.Load<Texture2D>("manette"), Content.Load<Texture2D>("controller"), Content.Load<Texture2D>("manetteit"), Content.Load<Texture2D>("manette-allemand"));
            Bbox = new MenuButton(Vector2.One, Content.Load<Texture2D>("checked"), Content.Load<Texture2D>("unchecked"), Content.Load<Texture2D>("unchecked"), Content.Load<Texture2D>("unchecked"));

            // Armes & Drogues ///////////////////////////////////////
            Bak47 = new MenuButton(Vector2.One, Content.Load<Texture2D>("hud_ak47"), Content.Load<Texture2D>("hud_ak47"), Content.Load<Texture2D>("hud_ak47"), Content.Load<Texture2D>("hud_ak47"));
            Bm3 = new MenuButton(Vector2.One, Content.Load<Texture2D>("hud_m3"), Content.Load<Texture2D>("hud_m3"), Content.Load<Texture2D>("hud_m3"), Content.Load<Texture2D>("hud_m3"));
            Bmp5 = new MenuButton(Vector2.One, Content.Load<Texture2D>("hud_mp5"), Content.Load<Texture2D>("hud_mp5"), Content.Load<Texture2D>("hud_mp5"), Content.Load<Texture2D>("hud_mp5"));
            Busp = new MenuButton(Vector2.One, Content.Load<Texture2D>("hud_usp"), Content.Load<Texture2D>("hud_usp"), Content.Load<Texture2D>("hud_usp"), Content.Load<Texture2D>("hud_usp"));

            Bshit = new MenuButton(Vector2.One, Content.Load<Texture2D>("hud_seringue"), Content.Load<Texture2D>("hud_seringue"), Content.Load<Texture2D>("hud_seringue"), Content.Load<Texture2D>("hud_seringue"));
            Bcoke = new MenuButton(Vector2.One, Content.Load<Texture2D>("hud_seringue"), Content.Load<Texture2D>("hud_seringue"), Content.Load<Texture2D>("hud_seringue"), Content.Load<Texture2D>("hud_seringue"));
            Bseringue = new MenuButton(Vector2.One, Content.Load<Texture2D>("hud_seringue"), Content.Load<Texture2D>("hud_seringue"), Content.Load<Texture2D>("hud_seringue"), Content.Load<Texture2D>("hud_seringue"));
            ////////////////////////////////////////////////////////////////////////

            //Armes bloquées-débloquées
            Bacheter = new MenuButton(Vector2.One, Content.Load<Texture2D>("acheter"), Content.Load<Texture2D>("acheterEN"), Content.Load<Texture2D>("acheterIT"), Content.Load<Texture2D>("acheterDE"));
            Bmunitions = new MenuButton(Vector2.One, Content.Load<Texture2D>("munitions"), Content.Load<Texture2D>("munitionsEN"), Content.Load<Texture2D>("munitionsIT"), Content.Load<Texture2D>("munitionsDE"));
            Bameliorer = new MenuButton(Vector2.One, Content.Load<Texture2D>("améliorer"), Content.Load<Texture2D>("améliorerEN"), Content.Load<Texture2D>("améliorerIT"), Content.Load<Texture2D>("améliorerDE"));

            // Positions
            positionBoutton1 = new Vector2(16 * Window.ClientBounds.Width / 24, Window.ClientBounds.Height / 8);
            positionBoutton2 = new Vector2(positionBoutton1.X, positionBoutton1.Y + Bjouer.GetTexturefr().Height + Window.ClientBounds.Height / 18);
            positionBoutton3 = new Vector2(positionBoutton2.X, positionBoutton2.Y + Bjouer.GetTexturefr().Height + Window.ClientBounds.Height / 18);
            positionBoutton4 = new Vector2(positionBoutton3.X, positionBoutton3.Y + Bjouer.GetTexturefr().Height + Window.ClientBounds.Height / 18);
            positionBoutton5 = new Vector2(positionBoutton4.X, positionBoutton4.Y + Bjouer.GetTexturefr().Height + Window.ClientBounds.Height / 18);
            #endregion

            ///////////////////////////////////////////////////// TEXTURES ! //////////////////////////////////////////////////////////////////////
            #region textures
            usp = new Texture2D[8, 4] { { Content.Load<Texture2D>("Player_usp_0_1"), Content.Load<Texture2D>("Player_usp_0_2"), Content.Load<Texture2D>("Player_usp_0_3"), Content.Load<Texture2D>("Player_usp_0_2") }, { Content.Load<Texture2D>("Player_usp_45_1"), Content.Load<Texture2D>("Player_usp_45_2"), Content.Load<Texture2D>("Player_usp_45_3"), Content.Load<Texture2D>("Player_usp_45_2") }, { Content.Load<Texture2D>("Player_usp_90_1"), Content.Load<Texture2D>("Player_usp_90_2"), Content.Load<Texture2D>("Player_usp_90_3"), Content.Load<Texture2D>("Player_usp_90_2") }, { Content.Load<Texture2D>("Player_usp_135_1"), Content.Load<Texture2D>("Player_usp_135_2"), Content.Load<Texture2D>("Player_usp_135_3"), Content.Load<Texture2D>("Player_usp_135_2") }, { Content.Load<Texture2D>("Player_usp_180_1"), Content.Load<Texture2D>("Player_usp_180_2"), Content.Load<Texture2D>("Player_usp_180_3"), Content.Load<Texture2D>("Player_usp_180_2") }, { Content.Load<Texture2D>("Player_usp_225_1"), Content.Load<Texture2D>("Player_usp_225_2"), Content.Load<Texture2D>("Player_usp_225_3"), Content.Load<Texture2D>("Player_usp_225_2") }, { Content.Load<Texture2D>("Player_usp_270_1"), Content.Load<Texture2D>("Player_usp_270_2"), Content.Load<Texture2D>("Player_usp_270_3"), Content.Load<Texture2D>("Player_usp_270_2") }, { Content.Load<Texture2D>("Player_usp_315_1"), Content.Load<Texture2D>("Player_usp_315_2"), Content.Load<Texture2D>("Player_usp_315_3"), Content.Load<Texture2D>("Player_usp_315_2") } };
            ak47 = new Texture2D[8, 4] { { Content.Load<Texture2D>("Player_ak_0_1"), Content.Load<Texture2D>("Player_ak_0_2"), Content.Load<Texture2D>("Player_ak_0_3"), Content.Load<Texture2D>("Player_ak_0_2") }, { Content.Load<Texture2D>("Player_ak_45_1"), Content.Load<Texture2D>("Player_ak_45_2"), Content.Load<Texture2D>("Player_ak_45_3"), Content.Load<Texture2D>("Player_ak_45_2") }, { Content.Load<Texture2D>("Player_ak_90_1"), Content.Load<Texture2D>("Player_ak_90_2"), Content.Load<Texture2D>("Player_ak_90_3"), Content.Load<Texture2D>("Player_ak_90_2") }, { Content.Load<Texture2D>("Player_ak_135_1"), Content.Load<Texture2D>("Player_ak_135_2"), Content.Load<Texture2D>("Player_ak_135_3"), Content.Load<Texture2D>("Player_ak_135_2") }, { Content.Load<Texture2D>("Player_ak_180_1"), Content.Load<Texture2D>("Player_ak_180_2"), Content.Load<Texture2D>("Player_ak_180_3"), Content.Load<Texture2D>("Player_ak_180_2") }, { Content.Load<Texture2D>("Player_ak_225_1"), Content.Load<Texture2D>("Player_ak_225_2"), Content.Load<Texture2D>("Player_ak_225_3"), Content.Load<Texture2D>("Player_ak_225_2") }, { Content.Load<Texture2D>("Player_ak_270_1"), Content.Load<Texture2D>("Player_ak_270_2"), Content.Load<Texture2D>("Player_ak_270_3"), Content.Load<Texture2D>("Player_ak_270_2") }, { Content.Load<Texture2D>("Player_ak_315_1"), Content.Load<Texture2D>("Player_ak_315_2"), Content.Load<Texture2D>("Player_ak_315_3"), Content.Load<Texture2D>("Player_ak_315_2") } };
            mp5 = new Texture2D[8, 4] { { Content.Load<Texture2D>("Player_mp5_0_1"), Content.Load<Texture2D>("Player_mp5_0_2"), Content.Load<Texture2D>("Player_mp5_0_3"), Content.Load<Texture2D>("Player_mp5_0_2") }, { Content.Load<Texture2D>("Player_mp5_45_1"), Content.Load<Texture2D>("Player_mp5_45_2"), Content.Load<Texture2D>("Player_mp5_45_3"), Content.Load<Texture2D>("Player_mp5_45_2") }, { Content.Load<Texture2D>("Player_mp5_90_1"), Content.Load<Texture2D>("Player_mp5_90_2"), Content.Load<Texture2D>("Player_mp5_90_3"), Content.Load<Texture2D>("Player_mp5_90_2") }, { Content.Load<Texture2D>("Player_mp5_135_1"), Content.Load<Texture2D>("Player_mp5_135_2"), Content.Load<Texture2D>("Player_mp5_135_3"), Content.Load<Texture2D>("Player_mp5_135_2") }, { Content.Load<Texture2D>("Player_mp5_180_1"), Content.Load<Texture2D>("Player_mp5_180_2"), Content.Load<Texture2D>("Player_mp5_180_3"), Content.Load<Texture2D>("Player_mp5_180_2") }, { Content.Load<Texture2D>("Player_mp5_225_1"), Content.Load<Texture2D>("Player_mp5_225_2"), Content.Load<Texture2D>("Player_mp5_225_3"), Content.Load<Texture2D>("Player_mp5_225_2") }, { Content.Load<Texture2D>("Player_mp5_270_1"), Content.Load<Texture2D>("Player_mp5_270_2"), Content.Load<Texture2D>("Player_mp5_270_3"), Content.Load<Texture2D>("Player_mp5_270_2") }, { Content.Load<Texture2D>("Player_mp5_315_1"), Content.Load<Texture2D>("Player_mp5_315_2"), Content.Load<Texture2D>("Player_mp5_315_3"), Content.Load<Texture2D>("Player_mp5_315_2") } };
            m3 = new Texture2D[8, 4] { { Content.Load<Texture2D>("Player_m3_0_1"), Content.Load<Texture2D>("Player_m3_0_2"), Content.Load<Texture2D>("Player_m3_0_3"), Content.Load<Texture2D>("Player_m3_0_2") }, { Content.Load<Texture2D>("Player_m3_45_1"), Content.Load<Texture2D>("Player_m3_45_2"), Content.Load<Texture2D>("Player_m3_45_3"), Content.Load<Texture2D>("Player_m3_45_2") }, { Content.Load<Texture2D>("Player_m3_90_1"), Content.Load<Texture2D>("Player_m3_90_2"), Content.Load<Texture2D>("Player_m3_90_3"), Content.Load<Texture2D>("Player_m3_90_2") }, { Content.Load<Texture2D>("Player_m3_135_1"), Content.Load<Texture2D>("Player_m3_135_2"), Content.Load<Texture2D>("Player_m3_135_3"), Content.Load<Texture2D>("Player_m3_135_2") }, { Content.Load<Texture2D>("Player_m3_180_1"), Content.Load<Texture2D>("Player_m3_180_2"), Content.Load<Texture2D>("Player_m3_180_3"), Content.Load<Texture2D>("Player_m3_180_2") }, { Content.Load<Texture2D>("Player_m3_225_1"), Content.Load<Texture2D>("Player_m3_225_2"), Content.Load<Texture2D>("Player_m3_225_3"), Content.Load<Texture2D>("Player_m3_225_2") }, { Content.Load<Texture2D>("Player_m3_270_1"), Content.Load<Texture2D>("Player_m3_270_2"), Content.Load<Texture2D>("Player_m3_270_3"), Content.Load<Texture2D>("Player_m3_270_2") }, { Content.Load<Texture2D>("Player_m3_315_1"), Content.Load<Texture2D>("Player_m3_315_2"), Content.Load<Texture2D>("Player_m3_315_3"), Content.Load<Texture2D>("Player_m3_315_2") } };

            textures_zombies = new Texture2D[8, 2] { { Content.Load<Texture2D>("Zombie_0_1"), Content.Load<Texture2D>("Zombie_0_2") }, { Content.Load<Texture2D>("Zombie_45_1"), Content.Load<Texture2D>("Zombie_45_2") }, { Content.Load<Texture2D>("Zombie_90_1"), Content.Load<Texture2D>("Zombie_90_2") }, { Content.Load<Texture2D>("Zombie_135_1"), Content.Load<Texture2D>("Zombie_135_2") }, { Content.Load<Texture2D>("Zombie_180_1"), Content.Load<Texture2D>("Zombie_180_2") }, { Content.Load<Texture2D>("Zombie_225_1"), Content.Load<Texture2D>("Zombie_225_2") }, { Content.Load<Texture2D>("Zombie_270_1"), Content.Load<Texture2D>("Zombie_270_2") }, { Content.Load<Texture2D>("Zombie_315_1"), Content.Load<Texture2D>("Zombie_315_2") } };
            #endregion

            ///////////////////////////////////////////////////// FONTS ! //////////////////////////////////////////////////////////////////////
            #region fonts
            hud_font = Content.Load<SpriteFont>("SpriteFont1");
            #endregion

            //////////////////////////////////////////////////// RECUP DE LA SAVE ///////////////////////////////////////////////////////////////
            #region save
            joueur = new Joueur("solo.save", usp, ak47, mp5, m3, Content, Window.ClientBounds.Height, Window.ClientBounds.Width);

            switch (joueur.GetWeapons("usp").GetLevel())
            {
                case 1:
                    prix_amelio_usp = "1000 $";
                    break;
                case 2:
                    prix_amelio_usp = "2000 $";
                    break;
                case 3:
                    prix_amelio_usp = "3000 $";
                    break;
                case 4:
                    prix_amelio_usp = "4000 $";
                    break;
                case 5:
                    prix_amelio_usp = "5000 $";
                    break;
                default:
                    prix_amelio_usp = "Max !";
                    break;
            }

            switch (joueur.GetWeapons("m3").GetLevel())
            {
                case 1:
                    prix_amelio_m3 = "1500 $";
                    break;
                case 2:
                    prix_amelio_m3 = "2000 $";
                    break;
                case 3:
                    prix_amelio_m3 = "4000 $";
                    break;
                case 4:
                    prix_amelio_m3 = "8000 $";
                    break;
                case 5:
                    prix_amelio_m3 = "10000 $";
                    break;
                default:
                    prix_amelio_m3 = "Max !";
                    break;
            }

            switch (joueur.GetWeapons("mp5").GetLevel())
            {
                case 1:
                    prix_amelio_mp5 = "2000 $";
                    break;
                case 2:
                    prix_amelio_mp5 = "3000 $";
                    break;
                case 3:
                    prix_amelio_mp5 = "5000 $";
                    break;
                case 4:
                    prix_amelio_mp5 = "10000 $";
                    break;
                case 5:
                    prix_amelio_mp5 = "15000 $";
                    break;
                default:
                    prix_amelio_mp5 = "Max !";
                    break;
            }

            switch (joueur.GetWeapons("ak47").GetLevel())
            {
                case 1:
                    prix_amelio_ak47 = "3000 $";
                    break;
                case 2:
                    prix_amelio_ak47 = "5000 $";
                    break;
                case 3:
                    prix_amelio_ak47 = "10000 $";
                    break;
                case 4:
                    prix_amelio_ak47 = "15000 $";
                    break;
                case 5:
                    prix_amelio_ak47 = "20000 $";
                    break;
                default:
                    prix_amelio_ak47 = "Max !";
                    break;
            }

            prix_amelio_m3 = "1500 $";
            prix_amelio_mp5 = "2500 $";
            prix_amelio_ak47 = "3000 $";
            #endregion

            base.Initialize();
        }