Ejemplo n.º 1
0
 /**
  * @return HexaCollection
  */
 public function getHexas()
 {
     if (is_null($this->hexas) || $this->hexas->count() == 0) {
         if (isset(CacheCarte::$centre2CoinGauche[$this->getCentre()->getId() . '_' . $this->getLargeur() . '_' . $this->getHauteur()])) {
             $this->hexas = CacheCarte::$hexasParCoinGauche[CacheCarte::$centre2CoinGauche[$this->getCentre()->getId() . '_' . $this->getLargeur() . '_' . $this->getHauteur()]];
         } elseif (isset(CacheCarte::$infosStatiquesParCoinGauche[$this->coinSupGauche()->getId() . '_' . $this->getLargeur() . '_' . $this->getHauteur()])) {
             $this->hexas = CacheCarte::$hexasParCoinGauche[$this->coinSupGauche()->getId() . '_' . $this->getLargeur() . '_' . $this->getHauteur()];
         } else {
             $this->buildHexas();
         }
     }
     return $this->hexas;
 }
Ejemplo n.º 2
0
 /**
  * @return Hexa
  */
 public function getPosition()
 {
     if (!$this->isModeRecul()) {
         // Mode déplacement
         if ($this->historiquePositions->count() == 0) {
             $ret = $this->getQg()->getHexa();
         } else {
             $ret = $this->historiquePositions->getLastElement();
         }
     } else {
         // Mode recul
         if ($this->positionRecul == 0) {
             $ret = $this->getQg()->getHexa();
         } elseif ($this->positionRecul < 0) {
             $ret = $this->hexaReculForce;
         } else {
             $ret = $this->historiquePositions[$this->positionRecul];
         }
     }
     return $ret;
 }