Пример #1
0
 /**
  * Eliminazione elemento da Matrice
  * @param FishInterface $fish
  * @return null
  */
 public function delete(FishInterface $fish)
 {
     $pos = $this->matrix->search($fish);
     if ($pos == null) {
         return null;
     }
     $this->population = $this->copyArrayWithoutFish($fish);
     $this->matrix->put(self::OCEAN, $pos);
 }
Пример #2
0
 /**
  * Sono state accorpate qui tutte le funzioni per una gestione più efficiente
  */
 public function moveAllFish()
 {
     $matrix = $this->worldMap->getMatrix();
     foreach ($matrix as $x => $rows) {
         foreach ($rows as $y => $fish) {
             $current = new Position($x, $y);
             // Gestisco il Movimento
             if ($fish instanceof MovableInterface) {
                 $current = $this->moveFish($fish, $current);
             }
             // Gestisco la vita
             if ($fish instanceof FishInterface) {
                 $this->aging($fish, $current);
             }
         }
     }
 }
Пример #3
0
 /**
  * Distruzione Mondo Wator.
  * @param Matrix $matrix
  *
  */
 public function startNuke(Matrix $matrix)
 {
     $w = $matrix->getWidth();
     $h = $matrix->getHeight();
     $matrix = new Matrix($w, $h);
 }