예제 #1
0
        /// <summary>
        /// À chaque tour de boucle il vérifie l'état du niveau et appelle la classe nécessaire
        /// </summary>
        /// <param name="gameTime">le temps du jeu</param>
        public override void Update(GameTime gameTime)
        {
            Game.IsMouseVisible = true;
            Point point = GestionnaireManager.GetPositionSouris();

            PosSouris = new Vector2(point.X, point.Y);

            if (PartieEnCours.EstRéussi)
            {
                InitialiserMenuContinuer();
            }

            if (PartieEnCours.EstÉchec)
            {
                Vector2 PosTexte = new Vector2(Game.Window.ClientBounds.Width / 2, Game.Window.ClientBounds.Height / 2 - 150);
                AfficheurTexte = new AfficheurTexte(Game, Color.Red, PosTexte, "Vous avez échoué.", INTERVALLE_MOYEN);
                Game.Components.Add(AfficheurTexte);
                //Boutton Recommencer = new Boutton(Game, "Recommencer Niveau", new Rectangle(Game.Window.ClientBounds.Width / 2, Game.Window.ClientBounds.Height / 2 - 50,
                //LARGEUR_BOUTTON, HAUTEUR_BOUTTON), Color.Blue, "fond écran blanc", "FondEcranGris", NbSoldatsContinuer,
                //PartieEnCours.GetNbSections(), INTERVALLE_MOYEN);
                //Bouttons.Add(Recommencer);
                Bouttons.Add(Exit);
                //Bouttons.Add(Réinitialiser);
                //Game.Components.Add(Réinitialiser);
                //Game.Components.Add(Recommencer);
                Game.Components.Add(Exit);
                Afficheur = new AfficheurNb(Game, Color.Red, CompteurNiveau, new Vector2(0, 0), "Niveau :", INTERVALLE_MOYEN);
                Game.Components.Add(Afficheur);
                PartieEnCours.EstÉchec = false;
            }

            if (GestionnaireManager.EstSourisActive)
            {
                GestionBouttonsDeLaListe();


                if (EstDansBoutton(Mute))
                {
                    if (GestionnaireManager.EstNouveauClicGauche())
                    {
                        Mute.ChangerDeCouleur();
                        PartieEnCours.FaireJouerMusique();
                    }
                }
            }
            base.Update(gameTime);
        }
예제 #2
0
        /// <summary>
        /// Initialise le bouton menu recommencer
        /// </summary>
        void InitialiserMenuRecommencer()
        {
            Vector2 PosTexte = new Vector2(Game.Window.ClientBounds.Width / 2, Game.Window.ClientBounds.Height / 2 - 150);

            AfficheurTexte = new AfficheurTexte(Game, Color.Red, PosTexte, "Vous avez échoué.", INTERVALLE_MOYEN);
            Game.Components.Add(AfficheurTexte);
            CalculerNbSoldats(DIMINUTION_SOLDTAS_RECOMMENCER);
            Boutton Recommencer = new Boutton(Game, "Recommencer", new Rectangle(Game.Window.ClientBounds.Width / 2 - LARGEUR_BOUTTON / 2, Game.Window.ClientBounds.Height / 2 - HAUTEUR_BOUTTON / 2,
                                                                                 LARGEUR_BOUTTON, HAUTEUR_BOUTTON), Color.Blue, NOM_IMAGE_AVANT, NOM_IMAGE_APRÈS, NbSoldatsContinuer,
                                              PartieEnCours.GetNbSections(), INTERVALLE_MOYEN);

            Bouttons.Add(Recommencer);
            Bouttons.Add(Exit);
            Game.Components.Add(Recommencer);
            Game.Components.Add(Exit);
            Afficheur = new AfficheurNb(Game, Color.Red, CompteurNiveau, new Vector2(0, 0), "Niveau :", INTERVALLE_MOYEN);
            Game.Components.Add(Afficheur);
            PartieEnCours.DéfinirÉtatJeu(PartieEnCours.EstRéussi, false);
        }
예제 #3
0
        /// <summary>
        /// initialise menu continuer
        /// </summary>
        void InitialiserMenuContinuer()
        {
            Vector2 PosTexte = new Vector2(Game.Window.ClientBounds.Width / 2, Game.Window.ClientBounds.Height / 2 - 150);

            AfficheurTexte = new AfficheurTexte(Game, Color.Red, PosTexte, "Bravo! Vous avez complété le niveau " + CompteurNiveau.ToString(), INTERVALLE_MOYEN);

            Game.Components.Add(AfficheurTexte);
            Boutton Continuer = new Boutton(Game, "Continuer", new Rectangle(Game.Window.ClientBounds.Width / 2 - LARGEUR_BOUTTON / 2, Game.Window.ClientBounds.Height / 2 - HAUTEUR_BOUTTON / 2,
                                                                             LARGEUR_BOUTTON, HAUTEUR_BOUTTON), Color.Blue, NOM_IMAGE_AVANT, NOM_IMAGE_APRÈS,
                                            CalculerNbSoldats(AUGMENTATION_SOLDATS_NIVEAU), CalculerNbSection(), INTERVALLE_MOYEN);

            NbSoldatsContinuer = Continuer.NombreSoldats;
            Bouttons.Add(Continuer);
            Bouttons.Add(Exit);
            Game.Components.Add(Exit);
            Game.Components.Add(Continuer);
            Afficheur = new AfficheurNb(Game, Color.Red, ++CompteurNiveau, new Vector2(0, 0), "Niveau :", INTERVALLE_MOYEN);
            Game.Components.Add(Afficheur);
            PartieEnCours.DéfinirÉtatJeu(false, PartieEnCours.EstÉchec);
        }
예제 #4
0
 /// <summary>
 /// Change le nombre de sections dans chaque niveau
 /// </summary>
 /// <returns>le nouveau nombre de section de niveaux</returns>
 int CalculerNbSection()
 {
     return(PartieEnCours.GetNbSections() + CompteurNiveau * AUGMENTATION_SECTION_NIVEAU);
 }
예제 #5
0
        /// <summary>
        /// Change le nombre de soldats par niveau
        /// </summary>
        /// <param name="valeur">le nouveau nombre de soldats</param>

        int CalculerNbSoldats(int valeur)
        {
            return(PartieEnCours.GetNbSoldat() + valeur);
        }