当前位置: 首页>>代码示例>>C++>>正文


C++ MoverPtr::isDestroyed方法代码示例

本文整理汇总了C++中MoverPtr::isDestroyed方法的典型用法代码示例。如果您正苦于以下问题:C++ MoverPtr::isDestroyed方法的具体用法?C++ MoverPtr::isDestroyed怎么用?C++ MoverPtr::isDestroyed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MoverPtr的用法示例。


在下文中一共展示了MoverPtr::isDestroyed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: render


//.........这里部分代码省略.........
	gos_SetRenderState( gos_State_TextureAddress, gos_TextureWrap );
	gos_SetRenderState( gos_State_ZCompare, 0);
	gos_SetRenderState(	gos_State_ZWrite, 0);
	DWORD gosTextureHandle = mcTextureManager->get_gosTextureHandle(viewRectHandle);

	gos_SetRenderState( gos_State_Texture, gosTextureHandle );

	gos_DrawQuads( &corners[0], 4 );

	unsigned long colors[MAX_MOVERS];
	unsigned long ringColors[MAX_MOVERS];
	Stuff::Vector3D positions[MAX_MOVERS];
	unsigned long ranges[MAX_MOVERS];
	bool		  selected[MAX_MOVERS];

	count = 0;

	//------------------------------------------------------------
	// draw non-movers, must do separate check for vehicles, I'm not sure they
	// have sensors
	for ( i = 0; i < MAX_TEAMS; ++i )
	{
		TeamSensorSystem* pSys = SensorManager->getTeamSensor( i );
		
		if ( pSys )
		{
			for ( int j = 0; j < pSys->numSensors; ++j )
			{
				SensorSystem* pSensor = pSys->sensors[j];

				if ( !pSensor )
					continue;

				if ( pSensor->owner->isDestroyed() || pSensor->owner->isDisabled() || pSensor->owner->getStatus() == OBJECT_STATUS_SHUTDOWN )
					continue;

				if ( pSensor->getRange() < 1.1 || pSensor->broken)
					continue;

				if (!pSensor->owner->getTeam())
					continue;

				ObjectClass objClass = pSensor->owner->getObjectClass();

				unsigned long colorBlip = pSensor->owner->getSelected() ? 0xff4bff4b : 0xff00cc00;
				unsigned long colorRing = 0xff00cc00;

			
				if ( pSensor->owner->getTeam()->isNeutral( Team::home ) )
				{
					colorBlip = pSensor->owner->getSelected() ? 0xff4c4cff : 0xff0000ff;
					colorRing = 0xff0000ff;
				}
				else if ( pSensor->owner->getTeam()->isEnemy( Team::home ) ) // enemy
				{
					
					{
						colorBlip = pSensor->owner->getSelected() ? 0xffff3f3f : 0xffff0000;
						colorRing = 0xffff0000;
					}
				}

				if ( objClass != BATTLEMECH && objClass != GROUNDVEHICLE)
				{
					if ( objClass == ARTILLERY )
					{
开发者ID:Ariemeth,项目名称:MechCommander2HD,代码行数:67,代码来源:gameTacMap.cpp

示例2: 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;
}
开发者ID:BobrDobr69,项目名称:mechcommander2,代码行数:89,代码来源:team.cpp


注:本文中的MoverPtr::isDestroyed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。