Exemple #1
0
 /**
  * Dit quel est l'angle de voisinage de la case demandée
  * @param Hexa $hexa
  * @return int ou null si la case n'est pas voisine de this
  */
 public function quelVoisin(Hexa $hexa)
 {
     $voisins = array();
     for ($angle = 0; $angle <= 5; $angle++) {
         $coords = self::getCoordsVoisins($this->getX(), $this->getY(), $angle);
         $coords = $this->getPartie()->coordsCorrigees($coords[0], $coords[1]);
         if (!is_null($coords)) {
             $voisins[$coords[0] . '_' . $coords[1]] = $angle;
         }
     }
     if (isset($voisins[$hexa->getX() . '_' . $hexa->getY()])) {
         return $voisins[$hexa->getX() . '_' . $hexa->getY()];
     }
     return null;
 }