本文整理汇总了C++中IEntity::GetFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ IEntity::GetFlags方法的具体用法?C++ IEntity::GetFlags怎么用?C++ IEntity::GetFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntity
的用法示例。
在下文中一共展示了IEntity::GetFlags方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateLaserEntity
IEntity* CLaserBeam::CreateLaserEntity()
{
IEntity* pLaserEntity = gEnv->pEntitySystem->GetEntity(m_laserEntityId);
if (pLaserEntity)
return pLaserEntity;
IEntity* pOwnerEntity = gEnv->pEntitySystem->GetEntity(m_ownerEntityId);
if (!pOwnerEntity)
return 0;
SEntitySpawnParams spawnParams;
spawnParams.pClass = gEnv->pEntitySystem->GetClassRegistry()->GetDefaultClass();
spawnParams.sName = "LaserBeam";
spawnParams.nFlags = (pOwnerEntity->GetFlags() | ENTITY_FLAG_NO_SAVE) & ~ENTITY_FLAG_CASTSHADOW;
IEntity* pNewEntity = gEnv->pEntitySystem->SpawnEntity(spawnParams);
if(pNewEntity)
{
m_laserEntityId = pNewEntity->GetId();
IEntityRenderProxy *pRenderProxy = (IEntityRenderProxy*)pNewEntity->GetProxy(ENTITY_PROXY_RENDER);
IRenderNode * pRenderNode = pRenderProxy?pRenderProxy->GetRenderNode():NULL;
if(pRenderNode)
pRenderNode->SetRndFlags(ERF_RENDER_ALWAYS,true);
SetLaserEntitySlots(false);
}
return pNewEntity;
}
示例2: DeleteDynamicEntities
void CCheckpointSystem::DeleteDynamicEntities()
{
IEntitySystem *pEntitySystem = gEnv->pEntitySystem;
IEntityItPtr pIt = pEntitySystem->GetEntityIterator();
//////////////////////////////////////////////////////////////////////////
pIt->MoveFirst();
while (!pIt->IsEnd())
{
IEntity * pEntity = pIt->Next();
uint32 nEntityFlags = pEntity->GetFlags();
// Local player must not be deleted.
if (nEntityFlags & ENTITY_FLAG_LOCAL_PLAYER)
continue;
if (nEntityFlags & ENTITY_FLAG_SPAWNED)
pEntitySystem->RemoveEntity( pEntity->GetId() );
}
// Force deletion of removed entities.
pEntitySystem->DeletePendingEntities();
//////////////////////////////////////////////////////////////////////////
// Reset entity pools
pEntitySystem->GetIEntityPoolManager()->ResetPools(false);
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:25,代码来源:CheckPointSystem.cpp
示例3: CreateFlock
int CScriptBind_Boids::CreateFlock( IFunctionHandler *pH, SmartScriptTable entity,int nType,SmartScriptTable paramTable )
{
IEntity *pEntity = GetEntity(entity);
if (!pEntity)
{
GameWarning( "Boids.CreateFlock called with an invalid entity" );
return pH->EndFunction();
}
pEntity->SetFlags( pEntity->GetFlags() | ENTITY_FLAG_CLIENT_ONLY );
CFlock *pFlock = 0;
switch (nType) {
case EFLOCK_BIRDS:
pFlock = new CBirdsFlock(pEntity);
break;
case EFLOCK_CHICKENS:
pFlock = new CChickenFlock(pEntity);
break;
case EFLOCK_FISH:
pFlock = new CFishFlock(pEntity);
break;
case EFLOCK_FROGS:
pFlock = new CFrogFlock(pEntity);
break;
case EFLOCK_TURTLES:
pFlock = new CTurtleFlock(pEntity);
break;
case EFLOCK_BUGS:
pFlock = new CBugsFlock(pEntity);
break;
}
if (pFlock==NULL)
{
GameWarning( "Boids.CreateFlock wrong flock type %d specified",nType );
return pH->EndFunction();
}
//////////////////////////////////////////////////////////////////////////
// Creates a boids proxy for this entity, and attach flock to it.
CBoidsProxy *pBoidsProxy = new CBoidsProxy(pEntity);
pEntity->SetProxy( ENTITY_PROXY_BOIDS,pBoidsProxy );
SBoidContext bc;
pFlock->GetBoidSettings( bc );
SBoidsCreateContext ctx;
if (ReadParamsTable( paramTable,bc,ctx ))
{
bc.entity = pEntity;
pFlock->SetBoidSettings( bc );
pFlock->CreateBoids( ctx );
}
// Assign flock to boids proxy and update some settings.
pBoidsProxy->SetFlock(pFlock);
return pH->EndFunction();
}
示例4: RemoveEntity
void CScriptbind_Entity::RemoveEntity(EntityId id, bool removeNow)
{
IEntity *pEntity = gEnv->pEntitySystem->GetEntity(id);
if(pEntity)
{
if(!(pEntity->GetFlags() & ENTITY_FLAG_NO_SAVE))
{
GetMonoScriptSystem()->GetCryBraryAssembly()->GetException("CryEngine", "EntityRemovalException", "Attempted to remove an entity placed via Editor")->Throw();
return;
}
gEnv->pEntitySystem->RemoveEntity(id, removeNow);
}
}
示例5: OnDropped
void CJaw::OnDropped( EntityId actorId, bool ownerWasAI)
{
CItem::OnDropped(actorId, ownerWasAI);
IEntity* pEntity = GetEntity();
uint32 flags = pEntity->GetFlags();
flags &= ~ENTITY_FLAG_NO_PROXIMITY;
pEntity->SetFlags(flags);
m_expended_ammo = 0;
m_laserGuider.TurnOffLaser();
}
示例6: TransitionToCorpse
void CReplayActor::TransitionToCorpse(IEntity& corpse)
{
IEntity* pEntity = GetEntity();
if(ICharacterInstance *pCharInst = pEntity->GetCharacter(0))
{
corpse.SetFlags(corpse.GetFlags() | (ENTITY_FLAG_CASTSHADOW));
Physicalize();
pEntity->MoveSlot(&corpse, 0);
pCharInst->SetFlags(pCharInst->GetFlags() | CS_FLAG_UPDATE);
LoadCharacter(pCharInst->GetFilePath());
// Make sure corpse is spawned with no glow parts
if(CTeamVisualizationManager* pTeamVisManager = g_pGame->GetGameRules()->GetTeamVisualizationManager())
{
pTeamVisManager->RefreshTeamMaterial(&corpse, false, m_isFriendly);
}
}
}
示例7: CreateRope
//------------------------------------------------------------------------
EntityId CVehicleActionDeployRope::CreateRope(IPhysicalEntity* pLinkedEntity, const Vec3& highPos, const Vec3& lowPos)
{
IEntitySystem* pEntitySystem = gEnv->pEntitySystem;
assert(pEntitySystem);
char pRopeName[256];
_snprintf(pRopeName, 256, "%s_rope_%d", m_pVehicle->GetEntity()->GetName(), m_seatId);
pRopeName[sizeof(pRopeName)-1] = '\0';
SEntitySpawnParams params;
params.sName = pRopeName;
params.nFlags = ENTITY_FLAG_CLIENT_ONLY;
params.pClass = pEntitySystem->GetClassRegistry()->FindClass("RopeEntity");
IEntity* pRopeEntity = pEntitySystem->SpawnEntity(params, true);
if (!pRopeEntity)
return 0;
pRopeEntity->SetFlags(pRopeEntity->GetFlags() | ENTITY_FLAG_CASTSHADOW );
pRopeEntity->CreateProxy(ENTITY_PROXY_ROPE);
IEntityRopeProxy* pEntityRopeProxy = (IEntityRopeProxy*) pRopeEntity->GetProxy(ENTITY_PROXY_ROPE);
if (!pEntityRopeProxy)
{
pEntitySystem->RemoveEntity(pRopeEntity->GetId());
return 0;
}
IRopeRenderNode* pRopeNode = pEntityRopeProxy->GetRopeRendeNode();
assert(pRopeNode);
Vec3 ropePoints[2];
ropePoints[0] = highPos;
ropePoints[1] = lowPos;
IRopeRenderNode::SRopeParams m_ropeParams;
m_ropeParams.nFlags = IRopeRenderNode::eRope_CheckCollisinos | IRopeRenderNode::eRope_Smooth;
m_ropeParams.fThickness = 0.05f;
m_ropeParams.fAnchorRadius = 0.1f;
m_ropeParams.nNumSegments = 8;
m_ropeParams.nNumSides = 4;
m_ropeParams.nMaxSubVtx = 3;
m_ropeParams.nPhysSegments = 8;
m_ropeParams.mass = 1.0f;
m_ropeParams.friction = 2;
m_ropeParams.frictionPull = 2;
m_ropeParams.wind.Set(0,0,0);
m_ropeParams.windVariance = 0;
m_ropeParams.waterResistance = 0;
m_ropeParams.jointLimit = 0;
m_ropeParams.maxForce = 0;
m_ropeParams.airResistance = 0;
m_ropeParams.fTextureTileU = 1.0f;
m_ropeParams.fTextureTileV = 10.0f;
pRopeNode->SetParams(m_ropeParams);
pRopeNode->SetPoints(ropePoints, 2);
pRopeNode->SetEntityOwner(m_pVehicle->GetEntity()->GetId());
pRopeNode->LinkEndEntities(m_pVehicle->GetEntity()->GetPhysics(), NULL);
return pRopeEntity->GetId();
}
示例8: OnDropped
//------------------------------------------------------------------------
void CWeapon::OnDropped(EntityId actorId, bool ownerWasAI)
{
BROADCAST_WEAPON_EVENT(OnDropped, (this, actorId));
BaseClass::OnDropped(actorId, ownerWasAI);
IEntity * pEntity = GetEntity();
if(gEnv->bServer)
{
bool removeWeapon = true;
if(gEnv->bMultiplayer && GetParams().check_clip_size_after_drop)
{
TFireModeVector::const_iterator firemodesEndIt = m_firemodes.end();
for (TFireModeVector::const_iterator firemodeCit = m_firemodes.begin(); firemodeCit != firemodesEndIt && removeWeapon; ++firemodeCit)
{
const CFireMode* pFiremode = *firemodeCit;
if (pFiremode)
{
IEntityClass* pFiremodeAmmo = pFiremode->GetAmmoType();
if (pFiremodeAmmo)
{
//only check the main ammo type given with the weapon
if(SWeaponAmmoUtils::FindAmmoConst(m_weaponsharedparams->ammoParams.ammo, pFiremodeAmmo))
{
int currentClipAmount = GetAmmoCount(pFiremodeAmmo);
int clipSize = pFiremode->GetClipSize();
if(currentClipAmount > 0 && currentClipAmount >= clipSize)
{
removeWeapon = false;
}
}
}
}
}
}
else
{
const bool outOfAmmo = OutOfAmmo(true) && !ownerWasAI;
const bool removeOnDrop = GetSharedItemParams()->params.remove_on_drop;
removeWeapon = !gEnv->pSystem->IsSerializingFile() && (outOfAmmo && removeOnDrop);
}
if(removeWeapon && GetParams().check_bonus_ammo_after_drop)
{
for(unsigned int i = 0; i < m_bonusammo.size(); ++i)
{
if(m_bonusammo[i].count > 0)
{
removeWeapon = false;
break;
}
}
}
if(removeWeapon)
{
if(gEnv->IsEditor())
{
pEntity->Hide(true);
}
else
{
gEnv->pEntitySystem->RemoveEntity(pEntity->GetId());
}
}
}
uint32 flags = pEntity->GetFlags();
flags &= ~ENTITY_FLAG_NO_PROXIMITY;
pEntity->SetFlags(flags);
m_expended_ammo = 0;
if(gEnv->bMultiplayer && (g_pGameCVars->i_highlight_dropped_weapons == 2) || (IsHeavyWeapon() && g_pGameCVars->i_highlight_dropped_weapons == 1))
{
HighlightWeapon(true, true);
}
}
示例9: GetEntity
//------------------------------------------
bool CC4Projectile::Init(IGameObject *pGameObject)
{
bool ok = CProjectile::Init(pGameObject);
// C4 should always be saved (unlike other projectiles)
IEntity* pEntity = GetEntity();
pEntity->SetFlags(pEntity->GetFlags() & ~ENTITY_FLAG_NO_SAVE);
if(!gEnv->bServer)
{
CreateLight();
}
if(gEnv->bMultiplayer)
{
CGameRules *pGameRules = g_pGame->GetGameRules();
pGameRules->RegisterTeamChangedListener(this);
pGameRules->RegisterClientConnectionListener(this);
}
return ok;
}