Ejemplo n.º 1
0
 // Méthode permettant d'afifcher les infos des monstres
 public void AfficherInfoMonstres(GestionMonstre gMonstre)
 {
     foreach (Monstre monstre in gMonstre.LstMonstres)
     {
         txtTestes.Text += monstre.Id.ToString() + " - " + monstre.Nom.ToString() + "\r\n";
     }
 }
Ejemplo n.º 2
0
        // Tests GestionMonstre
        private void BtnMonstre_Click(object sender, EventArgs e)
        {
            txtTestes.Clear();

            GestionMonstre gMonstre = new GestionMonstre();
            Monstre        monstre  = new Monstre
            {
                x       = 8,
                y       = 8,
                MondeId = 3114,
                Nom     = "Test",
                Niveau  = 17,
                StatPV  = 18
            };

            // Création d'un monstre
            gMonstre.CréerMonstre(monstre);
            AfficherInfoMonstres(gMonstre);

            // Modification d'un monstre
            txtTestes.Text += "\r\nModification du monstre créé : \r\n";
            txtTestes.Text += "Dernier monstre : " + gMonstre.LstMonstres.Last().Id + " - " + gMonstre.LstMonstres.Last().Nom + "\r\n";
            gMonstre.ModifierMonstre(monstre, monstre.x, monstre.y, 3111, "Pompom", 1, 8, 8f, 12f, null);
            monstre         = gMonstre.LstMonstres.Last();
            txtTestes.Text += "Info du monstre modifié : \r\n";
            txtTestes.Text += monstre.Id + " - " + monstre.x + " - " + monstre.y + " - " + monstre.MondeId + " - " + monstre.Niveau + " - " + monstre.Nom
                              + " - " + monstre.StatPV + " - " + monstre.StatDmgMax + " - " + monstre.StatDmgMin + "\r\n";
            txtTestes.Text += "Dernier monstre : " + gMonstre.LstMonstres.Last().Id + " - " + gMonstre.LstMonstres.Last().Nom + "\r\n";

            // Suppression d'un monstre
            txtTestes.Text += "\r\nSuppression de monstre : \r\n";
            txtTestes.Text += "Compte avant : " + gMonstre.LstMonstres.Count() + "\r\n";
            txtTestes.Text += "Dernier monstre : " + gMonstre.LstMonstres.Last().Id + " - " + gMonstre.LstMonstres.Last().Nom + "\r\n";
            gMonstre.SupprimerMonstre(monstre);
            txtTestes.Text += "Compte après : " + gMonstre.LstMonstres.Count() + "\r\n";
            txtTestes.Text += "Dernier monstre : " + gMonstre.LstMonstres.Last().Id + " - " + gMonstre.LstMonstres.Last().Nom + "\r\n";
        }