You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
850 B
PHTML

<?php
class TronPlayer{
8 years ago
public $url;
8 years ago
public $id;
public $name;
8 years ago
public $trail;
private $direction;
8 years ago
public $isAlive = true;
public function grow(Direction $dir){
$dest = $this->trail->last()->addDirection($dir);
if($dest == false){
$this->loose();
return false;
}
8 years ago
$this->trail->add($this->trail->last()->addDirection($dir));
8 years ago
return $this->trail->last();
}
public function loose(){
8 years ago
$this->isAlive = false;
8 years ago
$this->trail->emptyTrail();
8 years ago
//error_log($this->name." a perdu");
return false;
}
8 years ago
public function make($botId, Coords $initialsCoords,$name,$url){
8 years ago
$this->id = $botId;
8 years ago
$this->trail = new Trail;
$this->trail->add($initialsCoords);
8 years ago
$this->name = $name;
8 years ago
$this->url = $url;
$this->state = true;
8 years ago
}
public function __construct(){
8 years ago
$this->state = false;
8 years ago
}
8 years ago
}