本文整理汇总了C#中MapData.isConnectedTiles方法的典型用法代码示例。如果您正苦于以下问题:C# MapData.isConnectedTiles方法的具体用法?C# MapData.isConnectedTiles怎么用?C# MapData.isConnectedTiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapData
的用法示例。
在下文中一共展示了MapData.isConnectedTiles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: build
public MapData build()
{
map = new MapData (mapWidth, mapHeight, tileSize);
rooms = new List<Room>();
// Randomly create the rooms
for (int i = 0; i < numberOfRooms; i++) {
/* Add 1 because Random.Range() for ints excludes the max value */
int roomWidth = Random.Range(roomWidthRange[0], roomWidthRange[1] + 1);
int roomHeight = Random.Range(roomHeightRange[0], roomHeightRange[1] + 1);
int roomX;
if(mirrorMap) {
roomX = Random.Range(0, (map.width/2) - (roomWidth/2));
} else {
roomX = Random.Range(0, map.width - roomWidth + 1);
}
int roomY = Random.Range(0, map.height - roomHeight + 1);
Room r = new Room (roomX, roomY, roomWidth, roomHeight);
if(overlappingRooms || !roomCollides(r)) {
createRoom (r);
}
}
// Randomly connect the rooms
for (int i = 0; i < rooms.Count; i++) {
int j = i + Random.Range(1, rooms.Count);
j %= rooms.Count;
createHallway (rooms [i], rooms [j]);
}
// Make sure there are no isolated groups of rooms
connectAllRooms ();
verifyBorderWalls ();
if (mirrorMap) {
for (int x = 0; x < map.width/2; x++) {
for (int y = 0; y < map.height; y++) {
map.tiles [map.width - 1 - x, y] = map.tiles [x, y];
}
}
if(!map.isConnectedTiles(1)) {
connectMirroredMap ();
}
}
return map;
}