本文整理汇总了C++中MoverPtr::getLOSFactor方法的典型用法代码示例。如果您正苦于以下问题:C++ MoverPtr::getLOSFactor方法的具体用法?C++ MoverPtr::getLOSFactor怎么用?C++ MoverPtr::getLOSFactor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoverPtr
的用法示例。
在下文中一共展示了MoverPtr::getLOSFactor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: teamLineOfSight
//---------------------------------------------------------------------------
bool Team::teamLineOfSight(Stuff::Vector3D tPos, float extRad)
{
//-----------------------------------------------------------
// For each member of the team, check LOS to point provided.
for(size_t i = 0; i < rosterSize; i++)
{
MoverPtr obj = (MoverPtr)ObjectManager->getByWatchID(roster[i]);
if(!obj->isDisabled() && !obj->isDestroyed() && (obj->getStatus() != OBJECT_STATUS_SHUTDOWN))
{
Stuff::Vector3D distance;
distance.Subtract(tPos, obj->getPosition());
float dist = distance.GetApproximateLength();
//Figure out altitude above minimum terrain altitude and look up in table.
float baseElevation = MapData::waterDepth;
if(MapData::waterDepth < Terrain::userMin)
baseElevation = Terrain::userMin;
float altitude = obj->getPosition().z - baseElevation;
float altitudeIntegerRange = (Terrain::userMax - baseElevation) * 0.00390625f;
int32_t altLevel = 0;
if(altitudeIntegerRange > Stuff::SMALL)
altLevel = altitude / altitudeIntegerRange;
if(altLevel < 0)
altLevel = 0;
if(altLevel > 255)
altLevel = 255;
float radius = visualRangeTable[altLevel];
//Scouting specialty skill.
if(obj->isMover())
{
MoverPtr mover = (MoverPtr)obj;
if(mover->pilot && mover->pilot->isScout())
radius += (radius * 0.2f);
radius *= mover->getLOSFactor();
}
if(dist <= (radius * 25.0f * worldUnitsPerMeter))
{
if(lineOfSight(obj->getLOSPosition(), tPos, id, extRad, 0.0f, false))
return true;
}
}
}
//-------------------------------------------------------------------------
// Check the lookout towers now. You can find them in special Buildings!!
for(size_t spBuilding = 0; spBuilding < ObjectManager->numSpecialBuildings; spBuilding++)
{
if(ObjectManager->specialBuildings[spBuilding] &&
ObjectManager->specialBuildings[spBuilding]->getExists() &&
ObjectManager->specialBuildings[spBuilding]->isLookoutTower() &&
(ObjectManager->specialBuildings[spBuilding]->getTeamId() == id))
{
GameObjectPtr obj = ObjectManager->specialBuildings[spBuilding];
if(!obj->isDisabled() && !obj->isDestroyed() && (obj->getStatus() != OBJECT_STATUS_SHUTDOWN))
{
Stuff::Vector3D distance;
distance.Subtract(tPos, obj->getPosition());
float dist = distance.GetApproximateLength();
//Figure out altitude above minimum terrain altitude and look up in table.
float baseElevation = MapData::waterDepth;
if(MapData::waterDepth < Terrain::userMin)
baseElevation = Terrain::userMin;
float altitude = obj->getPosition().z - baseElevation;
float altitudeIntegerRange = (Terrain::userMax - baseElevation) * 0.00390625f;
int32_t altLevel = 0;
if(altitudeIntegerRange > Stuff::SMALL)
altLevel = altitude / altitudeIntegerRange;
if(altLevel < 0)
altLevel = 0;
if(altLevel > 255)
altLevel = 255;
float radius = visualRangeTable[altLevel];
//Scouting specialty skill.
if(obj->isMover())
{
MoverPtr mover = (MoverPtr)obj;
if(mover->pilot && mover->pilot->isScout())
radius += (radius * 0.2f);
radius *= mover->getLOSFactor();
}
if(dist <= (radius * 25.0f * worldUnitsPerMeter))
{
if(lineOfSight(obj->getLOSPosition(), tPos, id, 0.0f, obj->getAppearRadius(), false))
return true;
}
}
}
}
return false;
}