public Tile GetNextTile(Tile currentTile, ref LookingSide lookingSide) { var tilePosV2 = currentTile.position + GetDirection(lookingSide); if (tilePosV2.x >= size) { lookingSide = LookSide.NextLookingSide(lookingSide); tilePosV2 = currentTile.position + GetDirection(lookingSide); lookingSide = LookSide.NextLookingSide(lookingSide); } if (tilePosV2.x < 0) { lookingSide = LookSide.NextLookingSide(lookingSide); tilePosV2 = currentTile.position + GetDirection(lookingSide); lookingSide = LookSide.NextLookingSide(lookingSide); } if (tilePosV2.y >= size) { lookingSide = LookSide.NextLookingSide(lookingSide); tilePosV2 = currentTile.position + GetDirection(lookingSide); lookingSide = LookSide.NextLookingSide(lookingSide); } if (tilePosV2.y < 0) { lookingSide = LookSide.NextLookingSide(lookingSide); tilePosV2 = currentTile.position + GetDirection(lookingSide); lookingSide = LookSide.NextLookingSide(lookingSide); } return(GetTile(tilePosV2)); }
public void GetNeighbourTiles(Tile tile) { neighbourTiles.Clear(); var lookSide = LookingSide.up; for (int i = 0; i < 4; i++) { neighbourTiles.Add(GetTile(tile.position + GetDirection(lookSide))); lookSide = LookSide.NextLookingSide(lookSide); } }
public void Rotate() { lookingSide = LookSide.NextLookingSide(lookingSide); CheckLookingSide(); }