entity ai classes, pigs should look around

This commit is contained in:
GameHerobrine 2022-10-20 19:30:04 +03:00
parent 6f603fcbe9
commit 8d454e5ec9
12 changed files with 206 additions and 38 deletions

View file

@ -1,13 +1,22 @@
<?php
abstract class Living extends Entity implements Damageable, Pathfindable{
abstract class Living extends Entity implements Damageable{
public $pathFinder, $pathFound, $path, $pathNavigator, $target, $ai;
public function __construct(Level $level, $eid, $class, $type = 0, $data = array()){
$this->pathFinder = new AStar($this);
$this->pathFound = false;
$this->target = false;
$this->path = null;
$this->ai = new EntityAI($this);
$this->pathNavigator = new PathNavigator($this);
parent::__construct($level, $eid, $class, $type, $data);
$this->canBeAttacked = true;
}
public function getPathfinder(){ //Placeholder
return $this->pathFinder;
}
public function update(){
$this->ai->updateTasks();
parent::update();
}
}