本文整理汇总了C++中Door::setTargetLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ Door::setTargetLevel方法的具体用法?C++ Door::setTargetLevel怎么用?C++ Door::setTargetLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Door
的用法示例。
在下文中一共展示了Door::setTargetLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
Room *World::getRoom(const std::string &dungeon, int level)
{
Room *room = 0;
DungeonDescriptor dungDesc = worldDescriptor[dungeon];
RoomDescriptor roomDesc = dungDesc.at(level);
std::string parent = roomDesc["parent"];
std::string music = roomDesc["music"];
if (music != "")
music = "music/" + music;
if (roomDesc["method"] == "load")
{
room = RoomLoader::loadRoom("rooms/" + roomDesc["file"]);
// Patch up the doors
if (parent != "")
{
Door *d = room->findUnboundDoor(false);
if (d)
{
d->setTargetDungeon(parent);
d->setTargetLevel(0);
}
}
if (level > 0)
{
Door *d = room->findUnboundDoor(false);
if (d)
{
d->setTargetDungeon(dungeon);
d->setTargetLevel(level - 1);
}
}
if (level < (int)dungDesc.size() - 1)
{
Door *d = room->findUnboundDoor(true);
if (d)
{
d->setTargetDungeon(dungeon);
d->setTargetLevel(level + 1);
}
}
}
else if (roomDesc["method"] == "generate")
{
std::string tileSet = roomDesc["tileset"];
std::string enemies = roomDesc["enemies"];
int algorithm = fromString<int>(roomDesc["algorithm"]);
int width = fromString<int>(roomDesc["width"]);
int height = fromString<int>(roomDesc["height"]);
int chests = fromString<int>(roomDesc["chests"]);
int roomSeed = seed + level * 1000;
for (int i = 0; i < (int)dungeon.size(); i++)
{
roomSeed = (roomSeed + 431) * dungeon[i];
}
Random random(roomSeed);
room = RoomGenerator::generateRoom(width, height, (RoomGenerator::Algorithm)algorithm, "graphics/" + tileSet, enemies, chests, random);
if (parent != "")
{
RoomGenerator::placeDoor(room, parent, 0, false, random);
}
if (level > 0)
{
RoomGenerator::placeDoor(room, dungeon, level - 1, false, random);
}
if (level < (int)dungDesc.size() - 1)
{
RoomGenerator::placeDoor(room, dungeon, level + 1, true, random);
}
}
room->setDungeonName(dungeon);
room->setDungeonLevel(level);
room->setMusic(music);
return room;
}