void CreateTile(int x, int z) { Vector3 pos; //Sets position for x axis using inner radius. Offset depending on the row if (z % 2 == 0) { pos.x = x * HexTile.irad * 2f; } else { pos.x = (x * HexTile.irad * 2f) + HexTile.irad; } pos.y = 0f; //Since each row is offset, z only needs to move up 1.5 to fit pos.z = z * HexTile.orad * 1.5f; //Create tile with different prefabs if (isRoadTile(x, z)) { tile = Instantiate <HexTile>(tileRoadPrefab); tile.name = "Road"; } else if (isMountainTile(x, z)) { tile = Instantiate <HexTile>(tileMountainPrefab); tile.obstacle = true; tile.name = "Mountain"; } else if (isHillTile(x, z)) { tile = Instantiate <HexTile>(tileHillPrefab); //tile.gameObject.transform.tag = "Hill"; //IT tile.name = "Hill"; } else { tile = Instantiate <HexTile>(tileGrassPrefab); tile.name = "Grass"; } //Places tile at the position derived above tile.transform.localPosition = pos; //Attaches tile transform to parent transform (HexGrid object) //tile.transform.SetParent(transform, false); tiles[x, z] = tile; tile.xcoord = x; tile.zcoord = z; //tile.name = "HexTile[" + x + ", " + z + "]"; // tile.pgame = pgame; tile.CreateMesh(); }