예제 #1
0
        public void TestDeplacementNain()
        {
            Coordonnee destination;

            f = new FabriqueNain();
            c = new Coordonnee(1, 2); //Desert
            // - Vers case basique
            destination = new Coordonnee(1, 1); //Montagne
            u = f.fabriquerUnite(c);
            u.deplacement(destination);
            Assert.AreEqual(u.mouvement, 0);
            Assert.IsTrue(u.coordonnees.Equals(destination));
            // - Vers case eau
            destination = new Coordonnee(1, 3); //Eau
            u = f.fabriquerUnite(c);
            u.deplacement(destination);
            Assert.AreEqual(u.mouvement, 1);
            Assert.IsTrue(u.coordonnees.Equals(c));
            // - Montagne -> Montagne
            c = new Coordonnee(1, 1); //Montagne
            destination = new Coordonnee(3, 3); //Montagne
            u = f.fabriquerUnite(c);
            u.deplacement(destination);
            Assert.AreEqual(u.mouvement, 0);
            Assert.IsTrue(u.coordonnees.Equals(destination));
        }
예제 #2
0
 public void addUnite(Unite unite)
 {
     unites.Add(unite);
 }
예제 #3
0
파일: Carte.cs 프로젝트: Ghewalt/BorisWorld
 public bool presenceUniteEnnemie(Coordonnee coord, Unite amie)
 {
     foreach (Joueur j in SmallWorld.Instance.joueurs)
     {
         if (j.Peuple != amie.getPeuple())
         {
             foreach (Unite u in j.getUnites())
             {
                 if (u.coordonnees.Equals(coord))
                     return true;
             }
         }
     }
     return false;
 }
예제 #4
0
        public void TestPoints()
        {
            //Gaulois
            f = new FabriqueGaulois();
            // - Montagne
            c = new Coordonnee(1, 1);
            u = f.fabriquerUnite(c);
            Assert.AreEqual(u.getPoints(), 0);
            // - Plaine
            c = new Coordonnee(3, 1);
            u = f.fabriquerUnite(c);
            Assert.AreEqual(u.getPoints(), 2);
            // - Desert
            c = new Coordonnee(2, 1);
            u = f.fabriquerUnite(c);
            Assert.AreEqual(u.getPoints(), 1);
            // - Foret
            c = new Coordonnee(3, 2);
            u = f.fabriquerUnite(c);
            Assert.AreEqual(u.getPoints(), 1);

            //Nain
            f = new FabriqueNain();
            // - Montagne
            c = new Coordonnee(1, 1);
            u = f.fabriquerUnite(c);
            Assert.AreEqual(u.getPoints(), 1);
            // - Plaine
            c = new Coordonnee(3, 1);
            u = f.fabriquerUnite(c);
            Assert.AreEqual(u.getPoints(), 0);
            // - Desert
            c = new Coordonnee(2, 1);
            u = f.fabriquerUnite(c);
            Assert.AreEqual(u.getPoints(), 1);
            // - Foret
            c = new Coordonnee(3, 2);
            u = f.fabriquerUnite(c);
            Assert.AreEqual(u.getPoints(), 2);

            //Vinking
            f = new FabriqueViking();
            // - Montagne
            c = new Coordonnee(1, 1);
            u = f.fabriquerUnite(c);
            Assert.AreEqual(u.getPoints(), 1);
            // - Plaine
            c = new Coordonnee(3, 1);
            u = f.fabriquerUnite(c);
            Assert.AreEqual(u.getPoints(), 1);
            // - Desert
            c = new Coordonnee(2, 1);
            u = f.fabriquerUnite(c);
            Assert.AreEqual(u.getPoints(), 0);
            // - Foret
            c = new Coordonnee(3, 2);
            u = f.fabriquerUnite(c);
            Assert.AreEqual(u.getPoints(), 1);
            // - Eau
            c = new Coordonnee(1, 3);
            u = f.fabriquerUnite(c);
            Assert.AreEqual(u.getPoints(), 0);
            // - Bord Eau
            c = new Coordonnee(1, 2);
            u = f.fabriquerUnite(c);
            Assert.AreEqual(u.getPoints(), 2);
        }
예제 #5
0
        public void setInfoUniteSurvole(Unite u, int id)
        {
            //ID_UnitSurv.Text = "Unité n°" + id;

            // TODO : Ca marche pas
            Console.WriteLine(u.getPeuple());
            imgUnitSurv.Source = App.getImageFromPeuple(u.getPeuple());

            atkUnitSurv.Text = u.attaque.ToString();
            defUnitSurv.Text = u.defense.ToString();
            vieUnitSurv.Text = u.vie.ToString();

            GridUniteSurv.Visibility = System.Windows.Visibility.Visible;
        }