本文整理汇总了C++中IEntity::FreeSlot方法的典型用法代码示例。如果您正苦于以下问题:C++ IEntity::FreeSlot方法的具体用法?C++ IEntity::FreeSlot怎么用?C++ IEntity::FreeSlot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntity
的用法示例。
在下文中一共展示了IEntity::FreeSlot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetLaserEntitySlots
void CLaserBeam::SetLaserEntitySlots(bool freeSlots)
{
if(m_pLaserParams)
{
IEntity* pLaserEntity = GetLaserEntity();
if(pLaserEntity)
{
if(freeSlots)
{
if(m_laserDotSlot != -1)
pLaserEntity->FreeSlot(m_laserDotSlot);
if(m_laserGeometrySlot != -1)
pLaserEntity->FreeSlot(m_laserGeometrySlot);
m_laserDotSlot = m_laserGeometrySlot = -1;
pLaserEntity->DetachThis();
if(m_usingEntityAttachment)
{
if(IAttachmentManager* pAttachmentManager = GetLaserCharacterAttachmentManager())
{
if(IAttachment* pAttachment = pAttachmentManager->GetInterfaceByName(LASER_ATTACH_NAME))
{
pAttachment->ClearBinding();
}
}
}
}
else
{
m_laserGeometrySlot = pLaserEntity->LoadGeometry(-1, m_pLaserParams->laser_geometry_tp.c_str());
pLaserEntity->SetSlotFlags(m_laserGeometrySlot, pLaserEntity->GetSlotFlags(m_laserGeometrySlot)|ENTITY_SLOT_RENDER);
if (m_pLaserParams->show_dot)
{
IParticleEffect* pEffect = gEnv->pParticleManager->FindEffect(m_pLaserParams->laser_dot[GetIndexFromGeometrySlot()].c_str());
if(pEffect)
m_laserDotSlot = pLaserEntity->LoadParticleEmitter(-1,pEffect);
}
FixAttachment(pLaserEntity);
}
}
}
else
{
GameWarning("LASER PARAMS: Item of type CLaser is missing it's laser params!");
}
}
示例2: ActivateParticleEffect
//------------------------------------------------------------------------
void CVehiclePartParticleEffect::ActivateParticleEffect(bool activate)
{
IEntity *pEntity = m_pVehicle->GetEntity();
if(activate)
{
m_slot = pEntity->LoadParticleEmitter(-1, m_pParticleEffect, NULL, false, true);
if(m_slot > 0)
{
SpawnParams spawnParams;
spawnParams.fPulsePeriod = 1.0f;
pEntity->GetParticleEmitter(m_slot)->SetSpawnParams(spawnParams);
if(m_pHelper)
{
Matrix34 tm;
m_pHelper->GetVehicleTM(tm);
pEntity->SetSlotLocalTM(m_slot, tm);
}
}
}
else if(m_slot > 0)
{
pEntity->FreeSlot(m_slot);
m_slot = -1;
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:34,代码来源:VehiclePartParticleEffect.cpp
示例3: CreateLaserEntity
//---------------------------------------------------------------------------
void CLam::CreateLaserEntity()
{
if(m_pLaserEntityId)
{
//Check if entity is valid
IEntity *pEntity = m_pEntitySystem->GetEntity(m_pLaserEntityId);
if(!pEntity)
m_pLaserEntityId = 0;
}
if (!m_pLaserEntityId)
{
SEntitySpawnParams spawnParams;
spawnParams.pClass = gEnv->pEntitySystem->GetClassRegistry()->GetDefaultClass();
spawnParams.sName = "LAMLaser";
spawnParams.nFlags = (GetEntity()->GetFlags() | ENTITY_FLAG_NO_SAVE) & ~ENTITY_FLAG_CASTSHADOW;
IEntity *pNewEntity =gEnv->pEntitySystem->SpawnEntity(spawnParams);
//assert(pNewEntity && "Laser entity could no be spawned!!");
if(pNewEntity)
{
pNewEntity->FreeSlot(0);
pNewEntity->FreeSlot(1);
m_pLaserEntityId = pNewEntity->GetId();
if(IEntity* pEntity = GetEntity())
pEntity->AttachChild(pNewEntity);
IEntityRenderProxy *pRenderProxy = (IEntityRenderProxy*)pNewEntity->GetProxy(ENTITY_PROXY_RENDER);
IRenderNode * pRenderNode = pRenderProxy?pRenderProxy->GetRenderNode():NULL;
if(pRenderNode)
pRenderNode->SetRndFlags(ERF_RENDER_ALWAYS,true);
}
}
}
示例4: UpdateSurfaceEffects
//------------------------------------------------------------------------
void CVehicleMovementStdBoat::UpdateSurfaceEffects(const float deltaTime)
{
FUNCTION_PROFILER( GetISystem(), PROFILE_GAME );
if (0 == g_pGameCVars->v_pa_surface)
{
ResetParticles();
return;
}
IEntity* pEntity = m_pVehicle->GetEntity();
const Matrix34& worldTM = pEntity->GetWorldTM();
float distSq = worldTM.GetTranslation().GetSquaredDistance(gEnv->pRenderer->GetCamera().GetPosition());
if (distSq > sqr(300.f) || (distSq > sqr(50.f) && !m_pVehicle->GetGameObject()->IsProbablyVisible()))
return;
Matrix34 worldTMInv = worldTM.GetInverted();
const SVehicleStatus& status = m_pVehicle->GetStatus();
float velDot = status.vel * worldTM.GetColumn1();
float powerNorm = min(abs(m_movementAction.power), 1.f);
SEnvironmentParticles* envParams = m_pPaParams->GetEnvironmentParticles();
SEnvParticleStatus::TEnvEmitters::iterator end = m_paStats.envStats.emitters.end();
for (SEnvParticleStatus::TEnvEmitters::iterator emitterIt = m_paStats.envStats.emitters.begin(); emitterIt!=end; ++emitterIt)
{
if (emitterIt->layer < 0)
{
assert(0);
continue;
}
const SEnvironmentLayer& layer = envParams->GetLayer(emitterIt->layer);
SEntitySlotInfo info;
info.pParticleEmitter = 0;
pEntity->GetSlotInfo(emitterIt->slot, info);
float countScale = 1.f;
float sizeScale = 1.f;
float speedScale = 1.f;
float speed = 0.f;
// check if helper position is beneath water level
Vec3 emitterWorldPos = worldTM * emitterIt->quatT.t;
float waterLevel = gEnv->p3DEngine->GetWaterLevel(&emitterWorldPos);
int matId = 0;
if (emitterWorldPos.z <= waterLevel+0.1f && m_physStatus[k_mainThread].submergedFraction<0.999f)
{
matId = gEnv->pPhysicalWorld->GetWaterMat();
speed = status.speed;
bool spray = !strcmp(layer.GetName(), "spray");
if (spray)
{
// slip based
speed -= abs(velDot);
}
GetParticleScale(layer, speed, powerNorm, countScale, sizeScale, speedScale);
}
else
{
countScale = 0.f;
}
if (matId && matId != emitterIt->matId)
{
// change effect
IParticleEffect* pEff = 0;
const char* effect = GetEffectByIndex( matId, layer.GetName() );
if (effect && (pEff = gEnv->pParticleManager->FindEffect(effect)))
{
#if ENABLE_VEHICLE_DEBUG
if (DebugParticles())
CryLog("%s changes water sfx to %s (slot %i)", pEntity->GetName(), effect, emitterIt->slot);
#endif
if (info.pParticleEmitter)
{
info.pParticleEmitter->Activate(false);
pEntity->FreeSlot(emitterIt->slot);
}
emitterIt->slot = pEntity->LoadParticleEmitter(emitterIt->slot, pEff);
if (emitterIt->slot != -1)
pEntity->SetSlotLocalTM(emitterIt->slot, Matrix34(emitterIt->quatT));
info.pParticleEmitter = 0;
pEntity->GetSlotInfo(emitterIt->slot, info);
}
else
countScale = 0.f;
//.........这里部分代码省略.........