Exemple #1
0
 public void maj(List <Nourriture> listn)
 {
     foreach (Nourriture n in listn)
     {
         if (target == null)
         {
             if (n.etat == true && n.avarie == false)
             {
                 StrategieCourante = new Faim("Faim");
                 target            = n;
                 break;
             }
             else if (n.etat == false || n.avarie == true)
             {
                 StrategieCourante = new Immobile("Immobile");
                 target            = null;
             }
         }
         else
         {
             Nourriture nearest = closest(this, listn);
             if (nearest.etat == true && nearest.avarie == false)
             {
                 StrategieCourante = new Faim("Faim");
                 target            = nearest;
                 break;
             }
             else if (nearest.etat == false || nearest.avarie == true)
             {
                 StrategieCourante = new Immobile("Immobile");
                 target            = null;
             }
         }
     }
 }
Exemple #2
0
 public Pigeon(string nom)
 {
     this.nom          = nom;
     StrategieCourante = new Immobile("immobile");
     X = Hazard.Next(1, 20);
     Y = Hazard.Next(1, 20);
     //thread = new Thread(new ThreadStart(this.RunThread));
 }
Exemple #3
0
 public void maj(List <Human> listh)//tant que des hulains sont présent, les mouvement sont impossible
 {
     foreach (Human h in listh)
     {
         if (h.etat != false)
         {
             double dist = Math.Sqrt(Distance2Human(this, h));
             if (dist <= RANGE)
             {
                 detecte = true;
             }
             else
             {
                 detecte = false;
             }
             if (detecte)
             {
                 StrategieCourante = new Fuite("fuite");
                 target2           = h;
             }
         }
     }
 }