Esempio n. 1
0
 public function DistanceFrom(Coordinates $c)
 {
     global $NN_config;
     $distance = 0;
     if ($this->Galaxy() - $c->Galaxy() != 0) {
         $distance = abs($this->Galaxy() - $c->Galaxy()) * $NN_config["galaxy_distance"];
     } elseif ($this->System() - $c->System() != 0) {
         $distance = abs($this->System() - $c->System()) * $NN_config["system_distance"];
     } elseif ($this->Planet() - $c->Planet() != 0) {
         $distance = abs($this->Planet() - $c->Planet()) * $NN_config["planet_distance"];
     } else {
         $distance = 5;
     }
     return $distance;
 }