NostalgiaCore/src/utils/pathfinder/Path.php
2022-08-28 18:43:33 +03:00

21 lines
No EOL
489 B
PHP

<?php
class Path{
public $points = [];
public $currentPointIndex = 0;
public function addPoint(Node $point){
$this->points[] = $point;
}
public function getPointAndIncreaseIndex(){
return $this->points[$this->currentPointIndex++];
}
public function increaseIndexAndGetPoint(){
return isset($this->points[$this->currentPointIndex + 1]) ? $this->points[++$this->currentPointIndex] : null;
}
public function finish(){
$this->points = array_reverse($this->points);
}
}