mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
changed pathfinder(hopefully one last time)
This commit is contained in:
parent
8c12e0de26
commit
e11c40f645
28 changed files with 401 additions and 416 deletions
27
src/astarnavigator/PathTile.php
Normal file
27
src/astarnavigator/PathTile.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
class PathTile implements IElement
|
||||
{
|
||||
public $x, $y;
|
||||
|
||||
public function __construct($x, $y){
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
}
|
||||
|
||||
public function equals(PathTile $t){
|
||||
return $t->x === $this->x && $t->y === $this->y;
|
||||
}
|
||||
|
||||
public function addOffset($offset){
|
||||
$this->x += $offset[0];
|
||||
$this->y += $offset[1];
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __toString(){
|
||||
return $this->x.":".$this->y;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue