本文整理汇总了C++中Portal::canHearThrough方法的典型用法代码示例。如果您正苦于以下问题:C++ Portal::canHearThrough方法的具体用法?C++ Portal::canHearThrough怎么用?C++ Portal::canHearThrough使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Portal
的用法示例。
在下文中一共展示了Portal::canHearThrough方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visitRoom
void SoundEvent::visitRoom(Room *room, double strength) {
strength *= room->eventMultiplier(GameEventType::Sound);
if (strength >= 0.1) {
for (const GameObjectPtr &characterPtr : room->characters()) {
if (excludedCharacters().contains(characterPtr)) {
continue;
}
Character *character = characterPtr.cast<Character *>();
QString message = descriptionForStrengthAndCharacterInRoom(strength, character, room);
if (character->isPlayer()) {
character->send(message);
} else {
character->invokeTrigger("onsound", message);
}
addAffectedCharacter(characterPtr);
}
for (const GameObjectPtr &portalPtr : room->portals()) {
Portal *portal = portalPtr.cast<Portal *>();
Room *room1 = portal->room().unsafeCast<Room *>();
Room *room2 = portal->room2().unsafeCast<Room *>();
Room *oppositeRoom = (room == room1 ? room2 : room1);
if (hasBeenVisited(oppositeRoom) || !portal->canHearThrough()) {
continue;
}
double propagatedStrength = strength * portal->eventMultiplier(GameEventType::Sound);
if (propagatedStrength >= 0.1) {
addVisit(oppositeRoom, propagatedStrength);
}
}
}
}