ai changes

This commit is contained in:
GameHerobrine 2022-12-19 20:41:12 +03:00
parent 4835c15747
commit 5a3aeecd93
9 changed files with 196 additions and 98 deletions

View file

@ -2,26 +2,46 @@
abstract class TaskBase
{
/**
* @param EntityAI $ai
* @return bool
*/
abstract function shouldBeExecuted(EntityAI $ai);
/**
* @param EntityAI $ai
* @return bool
*/
abstract function wasExecuted(EntityAI $ai);
public $isStarted = false, $selfCounter = 0;
/**
* Executed when entity starts task. It is recommended to set counter here.
* @param EntityAI $ai
*/
abstract function onStart(EntityAI $ai);
/**
* Every tick until counter will be not equal to 0. It is recommended to update value of counter here.
* @param EntityAI $ai
*/
abstract function onUpdate(EntityAI $ai);
/**
* On task end.
* @param EntityAI $ai
*/
abstract function onEnd(EntityAI $ai);
/**
* Can start the task
* @param EntityAI $ai
*/
abstract function canBeExecuted(EntityAI $ai);
/**
* @return number ticks
*/
function getIdleTimeAfterEnd(){
return 0;
}
function reset(){
$this->isStarted = false;
$this->selfCounter = 0;
}
final function __toString(){
return get_class($this);
}
}