本文整理汇总了C++中Hexagon::getBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C++ Hexagon::getBoundingBox方法的具体用法?C++ Hexagon::getBoundingBox怎么用?C++ Hexagon::getBoundingBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hexagon
的用法示例。
在下文中一共展示了Hexagon::getBoundingBox方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: collideBorderTiles
// Caution: Can possibly deactivate this territory and activate another.
void Territory::collideBorderTiles()
{
for (int i = 0; i < borderCoordinates.size(); i++)
{
Hexagon * tile = floorTiles[borderCoordinates[i].q][borderCoordinates[i].r];
if (Collision::hitBoxesOverlap(tile->getBoundingBox(), player->getBoundingBox(), player->getSpeed()))
{
std::list<Vector2f> penetration;
if (SAT::collides(player->getConvexHull(), tile->getConvexHull(), player->getSpeed(), penetration))
{
// Move the player into another territory if the player is in a safe zone.
if (player->getIsInSafeZone())
{
Vector2f direction = Vector2fMath::unitVector(player->getPosition() - position);
Vector2f seekPosition = position + (direction * radius * 1.1f);
world->changeTerritory(seekPosition);
break;
}
else
{
player->translate(SAT::getShortestPenetration(penetration));
}
}
}
}
}
示例2: updatePlayer
// Updates the player and checks if the player is in a safe zone.
void Territory::updatePlayer(UpdateInfo info, Controls * controls)
{
player->update(info, controls);
player->setIsInSafeZone(false);
// Check if the player is in a safe zone.
for (int i = 0; i < 6 && !player->getIsInSafeZone(); i++)
{
for (int j = 0; j < safeZonesTiles[i].size(); j++)
{
Hexagon * tile = safeZonesTiles[i][j];
if (Collision::hitBoxesOverlap(tile->getBoundingBox(), Vector2f(), player->getBoundingBox(), player->getSpeed()))
{
std::list<Vector2f> penetration;
if (SAT::collides(player->getConvexHull(), tile->getConvexHull(), player->getSpeed(), penetration))
{
player->setIsInSafeZone(true);
player->setSafeZoneIndex(i);
break;
}
}
}
}
}