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


C++ IEntity::GetClass方法代码示例

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


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

示例1: FindPrev

//------------------------------------------------------------------------
int CInventory::FindPrev(IEntityClass *pClass, const char *category, int firstSlot, bool wrap) const
{
	IEntitySystem *pEntitySystem = gEnv->pEntitySystem;
	for (int i = (firstSlot > -1)?firstSlot+1:0; i < m_stats.slots.size(); i++)
	{
		IEntity *pEntity = pEntitySystem->GetEntity(m_stats.slots[firstSlot-i]);
		bool ok=true;
		if (pEntity->GetClass() != pClass)
			ok=false;
		if (ok && category && category[0] && strcmp(m_pGameFrameWork->GetIItemSystem()->GetItemCategory(pEntity->GetClass()->GetName()), category))
			ok=false;

		if (ok)
			return i;
	}

	if (wrap && firstSlot > 0)
	{
		int count = GetCount();
		for (int i = 0; i < firstSlot; i++)
		{
			IEntity *pEntity = pEntitySystem->GetEntity(m_stats.slots[count-i+firstSlot]);
			bool ok=true;
			if (pEntity->GetClass() != pClass)
				ok=false;
			if (ok && category && category[0] && strcmp(m_pGameFrameWork->GetIItemSystem()->GetItemCategory(pEntity->GetClass()->GetName()), category))
				ok=false;

			if (ok)
				return i;
		}
	}

	return -1;
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:36,代码来源:Inventory.cpp

示例2: OnHit

	//CGameRules::IHitInfo
	virtual void OnHit(const HitInfo &hitInfo)
	{
		if(GetPortBool(&m_actInfo, EIP_Enable) == false)
			return;

		EntityId shooter = GetPortEntityId(&m_actInfo, EIP_ShooterId);

		if(shooter != 0 && shooter != hitInfo.shooterId)
			return;

		EntityId target = GetPortEntityId(&m_actInfo, EIP_TargetId);

		if(target != 0 && target != hitInfo.targetId)
			return;

		IEntitySystem *pEntitySys = gEnv->pEntitySystem;
		IEntity *pTempEntity;

		// check weapon match
		const string &weapon = GetPortString(&m_actInfo, EIP_Weapon);

		if(weapon.empty() == false)
		{
			pTempEntity = pEntitySys->GetEntity(hitInfo.weaponId);

			if(pTempEntity == 0 || weapon.compare(pTempEntity->GetClass()->GetName()) != 0)
				return;
		}

		// check ammo match
		const string &ammo = GetPortString(&m_actInfo, EIP_Ammo);

		if(ammo.empty() == false)
		{
			pTempEntity = pEntitySys->GetEntity(hitInfo.projectileId);

			if(pTempEntity == 0 || ammo.compare(pTempEntity->GetClass()->GetName()) != 0)
				return;
		}

		ActivateOutput(&m_actInfo, EOP_ShooterId, hitInfo.shooterId);
		ActivateOutput(&m_actInfo, EOP_TargetId, hitInfo.targetId);
		ActivateOutput(&m_actInfo, EOP_WeaponId, hitInfo.weaponId);
		ActivateOutput(&m_actInfo, EOP_ProjectileId, hitInfo.projectileId);
		ActivateOutput(&m_actInfo, EOP_HitPos, hitInfo.pos);
		ActivateOutput(&m_actInfo, EOP_HitDir, hitInfo.dir);
		ActivateOutput(&m_actInfo, EOP_HitNormal, hitInfo.normal);
		ActivateOutput(&m_actInfo, EOP_Damage, hitInfo.damage);
		ISurfaceType *pSurface = g_pGame->GetGameRules()->GetHitMaterial(hitInfo.material);
		ActivateOutput(&m_actInfo, EOP_Material, string(pSurface ? pSurface->GetName() : ""));
		const char *hitType = "";

		if(CGameRules *pGR = g_pGame->GetGameRules())
			hitType = pGR->GetHitType(hitInfo.type);

		ActivateOutput(&m_actInfo, EOP_HitType, string(hitType));
	}
开发者ID:super-nova,项目名称:NovaRepo,代码行数:58,代码来源:FlowHitInfoNode.cpp

示例3: OnExplosion

	virtual void OnExplosion(const ExplosionInfo &explosionInfo)
	{
		if(GetPortBool(&m_actInfo, EIP_Enable) == false)
			return;

		EntityId shooter = GetPortEntityId(&m_actInfo, EIP_ShooterId);

		if(shooter != 0 && shooter != explosionInfo.shooterId)
			return;

		EntityId impactTarget = GetPortEntityId(&m_actInfo, EIP_ImpactTargetId);

		if(impactTarget != 0 && explosionInfo.impact && impactTarget != explosionInfo.impact_targetId)
			return;

		IEntitySystem *pEntitySys = gEnv->pEntitySystem;
		IEntity *pTempEntity = pEntitySys->GetEntity(explosionInfo.weaponId);

		// check ammo match
		const string &ammo = GetPortString(&m_actInfo, EIP_Ammo);

		if(ammo.empty() == false)
		{
			if(pTempEntity == 0 || ammo.compare(pTempEntity->GetClass()->GetName()) != 0)
				return;
		}

		string ammoClass = pTempEntity ? pTempEntity->GetClass()->GetName() : "";
		ActivateOutput(&m_actInfo, EOP_ShooterId, explosionInfo.shooterId);
		ActivateOutput(&m_actInfo, EOP_Ammo, ammoClass);
		ActivateOutput(&m_actInfo, EOP_Pos, explosionInfo.pos);
		ActivateOutput(&m_actInfo, EOP_Dir, explosionInfo.dir);
		ActivateOutput(&m_actInfo, EOP_Radius, explosionInfo.radius);
		ActivateOutput(&m_actInfo, EOP_Damage, explosionInfo.damage);
		ActivateOutput(&m_actInfo, EOP_Pressure, explosionInfo.pressure);
		ActivateOutput(&m_actInfo, EOP_HoleSize, explosionInfo.hole_size);
		const char *hitType = 0;

		if(CGameRules *pGR = g_pGame->GetGameRules())
			hitType = pGR->GetHitType(explosionInfo.type);

		hitType = hitType ? hitType : "";
		ActivateOutput(&m_actInfo, EOP_Type, string(hitType));

		if(explosionInfo.impact)
		{
			ActivateOutput(&m_actInfo, EOP_ImpactTargetId, explosionInfo.impact_targetId);
			ActivateOutput(&m_actInfo, EOP_ImpactNormal, explosionInfo.impact_normal);
			ActivateOutput(&m_actInfo, EOP_ImpactVelocity, explosionInfo.impact_velocity);
		}
	}
开发者ID:super-nova,项目名称:NovaRepo,代码行数:51,代码来源:FlowHitInfoNode.cpp

示例4: Init

//---------------------------------------
void CAreaAnnouncer::Init()
{
	Reset();

	//Scan for areas
	IEntityClass* pTargetClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("AreaBox");
	CRY_ASSERT_MESSAGE(pTargetClass, "Unable to find Target class AreaBox");

	if(pTargetClass)
	{
		IEntityIt* it = gEnv->pEntitySystem->GetEntityIterator();
		while ( !it->IsEnd() )
		{
			IEntity* pEntity = it->Next();
			if(pEntity->GetClass() == pTargetClass)
			{
				//check entityName
				IEntityAreaProxy *pArea = (IEntityAreaProxy*)pEntity->GetProxy(ENTITY_PROXY_AREA);
				if (pArea)
				{
					LoadAnnouncementArea(pEntity, pEntity->GetName());
				}
			}
		}
		it->Release();
	}

	CGameRules *pGameRules = g_pGame->GetGameRules();
	pGameRules->RegisterRevivedListener(this);
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:31,代码来源:AreaAnnouncer.cpp

示例5: IsKickedCarKill

bool SkillKill::IsKickedCarKill(CPlayer* pKicker, CPlayer* pTargetPlayer, EntityId vehicleId)
{
    if(pKicker->IsClient() && g_pGameCVars->g_mpKickableCars)
        {
            if (IVehicle* pKickedVehicle = g_pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(vehicleId))
                {
                    if (CVehicleMovementBase* pMovement = StaticCast_CVehicleMovementBase(pKickedVehicle->GetMovement()))
                        {
                            if (const SVehicleMovementLargeObjectInfo* info = pMovement->GetLargeObjectInfo())
                                {
                                    if (info->kicker && info->kicker == pKicker->GetEntityId())
                                        {
                                            return true;
                                        }
                                }
                        }
                }
            else
                {
                    static const IEntityClass* pDestroyedVehicleClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("DestroyedVehicle");
                    CRY_ASSERT(pDestroyedVehicleClass);
                    IEntity* pEntity = gEnv->pEntitySystem->GetEntity(vehicleId);
                    return pEntity && pEntity->GetClass() == pDestroyedVehicleClass;
                }
        }

    return false;
}
开发者ID:eBunny,项目名称:EmberProject,代码行数:28,代码来源:SkillKill.cpp

示例6: StartFire

//------------------------------------------------------------------------
void CDetonate::StartFire()
{
	if (CanFire(false))
	{
		CActor *pOwner=m_pWeapon->GetOwnerActor();

		CCCPOINT(DetonateFireMode_StartFireOK);
		m_pWeapon->RequireUpdate(eIUS_FireMode);
		m_detonationTimer = 0.1f;
		m_pWeapon->PlayAction(GetFragmentIds().fire);
		m_pWeapon->RequestDetonate();
	}
	else
	{
#if !defined(_RELEASE)
		IFireMode* pFM = m_pWeapon->GetFireMode(m_pWeapon->GetCurrentFireMode());
		EntityId projectileId = pFM ? pFM->GetProjectileId() : 0;
		IEntity * projectile = gEnv->pEntitySystem->GetEntity(projectileId);

		CryLog ("[Detonate] Failure to detonate %s '%s' (timer = %.4f, can detonate = %s, fire mode = '%s') projectile = %u (%s '%s')",
						m_pWeapon->GetEntity()->GetClass()->GetName(),
						m_pWeapon->GetEntity()->GetName(),
						m_detonationTimer,
						m_canDetonate ? "TRUE" : "FALSE",
						pFM ? pFM->GetName() : "NONE",
						projectileId,
						projectile ? projectile->GetClass()->GetName() : "NONE",
						projectile ? projectile->GetName() : "N/A");
#endif

		CCCPOINT_IF(m_detonationTimer > 0.0f, DetonateFireMode_CannotFire_TimerNotReachedZero);
		CCCPOINT(DetonateFireMode_CannotFire);
	}
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:35,代码来源:Detonate.cpp

示例7: GetCountOfClass

//------------------------------------------------------------------------
int CInventory::GetCountOfClass(const char *className) const
{
	int count = 0;

	IEntitySystem *pEntitySystem = gEnv->pEntitySystem;
	
	IEntityClass* pClass = (className != NULL) ? pEntitySystem->GetClassRegistry()->FindClass( className ) : NULL;
	if (pClass)
	{
		for (TInventoryCIt it = m_stats.slots.begin(); it != m_stats.slots.end(); ++it)
		{
			IEntity *pEntity = pEntitySystem->GetEntity(*it);
			if ((pEntity != NULL) && (pEntity->GetClass() == pClass))
			{
					++count;
			}
		}
		TInventoryVectorEx::const_iterator endEx = m_stats.accessorySlots.end();
		for (TInventoryVectorEx::const_iterator cit = m_stats.accessorySlots.begin(); cit!=endEx; ++cit)
		{
			if (*cit == pClass)
			{
				count++;
			}
		}
	}

	return count;
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:30,代码来源:Inventory.cpp

示例8: QueryProjectiles

//------------------------------------------------------------------------
int  CWeaponSystem::QueryProjectiles(SProjectileQuery &q)
{
	IEntityClass *pClass = q.ammoName?gEnv->pEntitySystem->GetClassRegistry()->FindClass(q.ammoName):0;
	m_queryResults.resize(0);

	if(q.box.IsEmpty())
	{
		for(TProjectileMap::iterator it = m_projectiles.begin(); it!=m_projectiles.end(); ++it)
		{
			IEntity *pEntity = it->second->GetEntity();

			if(pClass == 0 || pEntity->GetClass() == pClass)
				m_queryResults.push_back(pEntity);
		}
	}
	else
	{
		for(TProjectileMap::iterator it = m_projectiles.begin(); it!=m_projectiles.end(); ++it)
		{
			IEntity *pEntity = it->second->GetEntity();

			if(q.box.IsContainPoint(pEntity->GetWorldPos()))
			{
				m_queryResults.push_back(pEntity);
			}
		}
	}

	q.nCount = int(m_queryResults.size());

	if(q.nCount)
		q.pResults = &m_queryResults[0];

	return q.nCount;
}
开发者ID:super-nova,项目名称:NovaRepo,代码行数:36,代码来源:WeaponSystem.cpp

示例9: GetEntityType

EEntityType GetEntityType(EntityId id)
{
	int type = eET_Unknown;

	IEntitySystem *pEntitySystem = gEnv->pEntitySystem;
	if (pEntitySystem)
	{
		IEntity *pEntity = pEntitySystem->GetEntity(id);
		if (pEntity)
		{
			type = eET_Valid;

			IEntityClass *pClass = pEntity->GetClass();
			if (pClass)
			{
				const char* className = pClass->GetName();

				// Check AI
				if (pEntity->GetAI())
				{
					type |= eET_AI;
				}
				
				// Check actor
				IActorSystem *pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
				if (pActorSystem)
				{
					IActor *pActor = pActorSystem->GetActor(id);
					if (pActor)
					{
						type |= eET_Actor;
					}
				}

				// Check vehicle
				IVehicleSystem *pVehicleSystem = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem();
				if (pVehicleSystem)
				{
					if (pVehicleSystem->IsVehicleClass(className))
					{
						type |= eET_Vehicle;
					}
				}

				// Check item
				IItemSystem *pItemSystem = gEnv->pGame->GetIGameFramework()->GetIItemSystem();
				if (pItemSystem)
				{
					if (pItemSystem->IsItemClass(className))
					{
						type |= eET_Item;
					}
				}
			}
		}
	}

	return (EEntityType)type;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:59,代码来源:FlowEntityIterator.cpp

示例10: ReAttachAccessory

//------------------------------------------------------------------------
void CItem::ReAttachAccessory(EntityId id)
{
	IEntity *pEntity = gEnv->pEntitySystem->GetEntity(id);

	if(pEntity)
	{
		ItemString className = pEntity->GetClass()->GetName();
		m_accessories[className] = id;
		ReAttachAccessory(className);
	}
}
开发者ID:super-nova,项目名称:NovaRepo,代码行数:12,代码来源:ItemAccessory.cpp

示例11: GetItemString

//------------------------------------------------------------------------
const char* CInventory::GetItemString(int slotId) const
{
	if (slotId<0 || slotId>=m_stats.slots.size())
		return "";

	EntityId ItemId = GetItem(slotId);
	IEntity* pEntity =	gEnv->pEntitySystem->GetEntity(ItemId);
	if(pEntity)
		return pEntity->GetClass()->GetName();
	else
		return "";
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:13,代码来源:Inventory.cpp

示例12: AddBurnPoint

void CBurnEffectManager::AddBurnPoint(
	const EventPhysCollision& pCollision, SMikeBulletParams* pBurnBulletParams, int hitType, bool shooterIsPlayer,
	const uint8 shooterFactionID)
{
	int surfaceType = pCollision.idmat[1];

	CGameRules* pGameRules = g_pGame->GetGameRules();
	IEntity* pEntity = pCollision.iForeignData[1] == PHYS_FOREIGN_ID_ENTITY ? (IEntity*)pCollision.pForeignData[1] : NULL;
	
	const SMikeBulletParams::SBurnParams* pBurnParams = NULL;
	EntityId entityId = 0;
	
	if(pEntity)
	{
		pBurnParams = pBurnBulletParams->GetBurnClassParams(pEntity->GetClass());
		entityId = pEntity->GetId();
	}

	if(!pBurnParams)
	{
		entityId = 0;
		pBurnParams = pBurnBulletParams->GetBurnSurfaceParams(surfaceType);
	}
	
	// Burn-points are 'recycled/shared' between entities, so we can only differentiate
	// between factions. This limits the 'hit detection' to a per factions basis also.
	TBurnPoints::iterator best = entityId ? FindBurnPointOnEntity(entityId, shooterFactionID) : FindClosestBurnPoint(pCollision.pt, surfaceType, shooterFactionID);

	if (best != m_burnPoints.end())
	{
		best->m_accumulation += best->m_pBurnParams->m_buildUp;
		best->m_accumulationDelay = best->m_pBurnParams->m_dissipationDelay;
	}
	else
	{
		SBurnPoint burnPoint;
		burnPoint.m_pBurnParams = pBurnParams;
		burnPoint.m_effect = 0;
		burnPoint.m_accumulation = burnPoint.m_pBurnParams->m_buildUp;
		burnPoint.m_accumulationDelay = burnPoint.m_pBurnParams->m_dissipationDelay;
		burnPoint.m_radius = pBurnParams->m_radius;
		burnPoint.m_position = pCollision.pt;
		burnPoint.m_surfaceType = surfaceType;
		burnPoint.m_attachedEntityId = entityId;
		burnPoint.m_hitType = hitType;
		burnPoint.m_shootByPlayer = shooterIsPlayer;
		burnPoint.m_shooterFactionID = shooterFactionID;
		PushNewBurnPoint(pCollision, &burnPoint);
	}

	SpawnImpactEffect(pCollision, pBurnParams->m_impactEffectName.c_str());
}
开发者ID:Xydrel,项目名称:Infected,代码行数:52,代码来源:MikeBullet.cpp

示例13: CanSpectacularKillOn

//-----------------------------------------------------------------------
bool CSpectacularKill::CanSpectacularKillOn(const CActor* pTarget) const
{
	const SSpectacularKillCVars& skCVars = g_pGameCVars->g_spectacularKill;

	bool bReturn = false;

	if (pTarget)
	{
		IEntity* pTargetEntity = pTarget->GetEntity();
		// Check params existence for the target class
		const SSpectacularKillParams* pTargetParams = GetParamsForClass(pTargetEntity->GetClass());
		if (pTargetParams)
		{
			// Check redundancy, number of anims
			const float fElapsedSinceLastKill = gEnv->pTimer->GetFrameStartTime().GetSeconds() - s_lastKillInfo.timeStamp;
			if (fElapsedSinceLastKill > skCVars.minTimeBetweenKills)
			{
				const int numAnims = static_cast<int>(pTargetParams->animations.size());
				if (numAnims > 0)
				{
					const SSpectacularKillAnimation& animData = pTargetParams->animations[0];
					if ((numAnims > 1) || ((fElapsedSinceLastKill > skCVars.minTimeBetweenSameKills) ||
						(animData.killerAnimation.compare(s_lastKillInfo.killerAnim) != 0)))
					{
						// Check distance with the player
						IEntity* pLocalPlayerEntity = gEnv->pEntitySystem->GetEntity(g_pGame->GetIGameFramework()->GetClientActorId());
						CRY_ASSERT(pLocalPlayerEntity);
						if (!pLocalPlayerEntity || (skCVars.sqMaxDistanceFromPlayer < 0.0f) || 
							(pLocalPlayerEntity->GetWorldPos().GetSquaredDistance(pTarget->GetEntity()->GetWorldPos()) < skCVars.sqMaxDistanceFromPlayer))
						{
							// Check if target is not invulnerable
							bool bIsInvulnerable = false;
							if (IScriptTable* pTargetScript = pTargetEntity->GetScriptTable())
							{
								HSCRIPTFUNCTION isInvulnerableFunc = NULL;
								if (pTargetScript->GetValue("IsInvulnerable", isInvulnerableFunc) && isInvulnerableFunc)
									Script::CallReturn(gEnv->pScriptSystem, isInvulnerableFunc, pTargetScript, bIsInvulnerable);
							}
							if(!bIsInvulnerable)
							{
								// Check player's visTable to maximize the opportunities for him to actually see this?
								bReturn = true;
							}
						}
					}
				}
			}
		}
	}

	return bReturn;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:53,代码来源:SpectacularKill.cpp

示例14: OnEntityAddedToRadar

void CMPTutorial::OnEntityAddedToRadar(EntityId id)
{
	// if the entity is an enemy player, show the prompt.
	if(m_events[eTE_EnemySpotted].m_status != eMS_Checking)
		return;

	IEntity* pEntity = gEnv->pEntitySystem->GetEntity(id);
	if(pEntity && pEntity->GetClass() == m_pPlayerClass)
	{
		if(g_pGame->GetGameRules()->GetTeam(id) != g_pGame->GetGameRules()->GetTeam(g_pGame->GetIGameFramework()->GetClientActor()->GetEntityId()))
		{
			TriggerEvent(eTE_EnemySpotted);
		}
	}
}
开发者ID:RenEvo,项目名称:dead6,代码行数:15,代码来源:MPTutorial.cpp

示例15: GetSlotFromEntityID

CInventory::EInventorySlots CInventory::GetSlotFromEntityID( EntityId entityID ) const
{
	IEntity* pEntity = gEnv->pEntitySystem->GetEntity(entityID);

	if (pEntity)
	{
		const char* category = m_pGameFrameWork->GetIItemSystem()->GetItemCategory(pEntity->GetClass()->GetName());

		if (!category || category[0]=='\0')
			return eInventorySlot_Last;

		TCategoriesToSlot::const_iterator catToSlotCit = m_stats.categoriesToSlot.find(CONST_TEMP_STRING(category));
		if (catToSlotCit == m_stats.categoriesToSlot.end())
			return eInventorySlot_Last;

		return catToSlotCit->second;
	}

	return eInventorySlot_Last;
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:20,代码来源:Inventory.cpp


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