private function __construct(array $tiles, DungeonMap $map)
 {
     foreach ($tiles as $tile) {
         $dungeonTile = new DungeonTile($tile->getX(), $tile->getY());
         $this->clientMap[$map->getTileIndex($dungeonTile)] = [];
         $this->clientMap[$map->getTileIndex($dungeonTile)] = [$dungeonTile];
     }
 }
Beispiel #2
0
 public function testConstructor()
 {
     $littleMap = new LittleMap(new Tile(3, 4), 1);
     $map = new Map(new Tile(3, 4), 1);
     $this->assertEquals($littleMap->getAllTiles()[0], $map->getAllTiles()[0]);
 }
Beispiel #3
0
 public function testPositionOfCoupleOfCoordinateInsideAMap()
 {
     $center = new Tile(0, 0);
     $map = new Map($center, 2);
     $this->assertEquals([[[0, 0], 0], [[1, 0], 1], [[0, -1], 1], [[-1, -1], 1], [[-1, 0], 1], [[-1, 1], 1], [[0, 1], 1]], $map->getAllTiles());
     $this->assertSame(4, $map->getPositionOfTile(new Tile(-1, 0)));
     $this->assertSame(0, $map->getPositionOfTile(new Tile(0, 0)));
 }