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


C++ GetEntityId函数代码示例

本文整理汇总了C++中GetEntityId函数的典型用法代码示例。如果您正苦于以下问题:C++ GetEntityId函数的具体用法?C++ GetEntityId怎么用?C++ GetEntityId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: GetEntityId

void CCinematicWeapon::StopFire()
{
	BaseClass::StopFire();

	m_fireSound.Stop( GetEntityId() );
	m_stopFireTailSound.Play( GetEntityId() );
}
开发者ID:Xydrel,项目名称:Infected,代码行数:7,代码来源:CinematicWeapon.cpp

示例2: GetGameObject

//------------------------------------------------------------------------
void CItem::InitClient(int channelId)
{
	// send the differences between the current, and the initial setup
	for(TAccessoryMap::iterator it=m_accessories.begin(); it != m_accessories.end(); ++it)
		GetGameObject()->InvokeRMI(ClAttachAccessory(), RequestAttachAccessoryParams(it->first.c_str()), eRMI_ToClientChannel, channelId);

	IActor *pOwner=GetOwnerActor();

	if(!pOwner)
		return;

	// only send the pickup message if the player is connecting
	// for items spawned during gameplay, CItem::PickUp is already sending the pickup message
	INetChannel *pNetChannel=m_pGameFramework->GetNetChannel(channelId);

	if(pNetChannel && pNetChannel->GetContextViewState()<eCVS_InGame)
	{
		if(!m_stats.mounted && !m_stats.used)
		{
			pOwner->GetGameObject()->InvokeRMIWithDependentObject(CActor::ClPickUp(),
					CActor::PickItemParams(GetEntityId(), m_stats.selected, false), eRMI_ToClientChannel, GetEntityId(), channelId);
			//GetOwnerActor()->GetGameObject()->InvokeRMI(CActor::ClPickUp(),
			//	CActor::PickItemParams(GetEntityId(), m_stats.selected, false), eRMI_ToClientChannel, channelId);
		}
	}

	if(m_stats.mounted && m_stats.used)
	{
		pOwner->GetGameObject()->InvokeRMIWithDependentObject(CActor::ClStartUse(),
				CActor::ItemIdParam(GetEntityId()), eRMI_ToClientChannel, GetEntityId(), channelId);
	}
}
开发者ID:Hellraiser666,项目名称:CryGame,代码行数:33,代码来源:ItemClientServer.cpp

示例3: hudEvent

void CC4Projectile::SetupUIIcon()
{
	if(GetEntityId())
	{
		const bool dangerous = !m_OnSameTeam || g_pGame->GetGameRules()->GetFriendlyFireRatio() > 0.f;
		//If the C4 can't harm us we show a C4 icon (ThreatAwareness shows enemy C4 as well)
		const CPlayer* pPlayer = static_cast<CPlayer*>(gEnv->pGame->GetIGameFramework()->GetClientActor());
		const bool shouldShow = !dangerous;
		if(shouldShow && !m_isShowingUIIcon)
		{
			SHUDEvent hudEvent(eHUDEvent_OnC4Spawned);
			hudEvent.AddData((int)GetEntityId());
			hudEvent.AddData((bool)dangerous);
			CHUDEventDispatcher::CallEvent(hudEvent);
			m_isShowingUIIcon = true;
		}
		else if(m_isShowingUIIcon && !shouldShow)
		{
			SHUDEvent hudEvent(eHUDEvent_RemoveC4Icon);
			hudEvent.AddData((int)GetEntityId());
			CHUDEventDispatcher::CallEvent(hudEvent);
			m_isShowingUIIcon = false;
		}
	}
}
开发者ID:Xydrel,项目名称:Infected,代码行数:25,代码来源:C4Projectile.cpp

示例4: ConstructShape

	void ConstructShape(float frameOffset)
	{
		CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), GetEntityId());
		if (!cmpPosition)
			return;

		if (!cmpPosition->IsInWorld())
			return;

		float x, z, rotY;
		cmpPosition->GetInterpolatedPosition2D(frameOffset, x, z, rotY);

		CmpPtr<ICmpFootprint> cmpFootprint(GetSimContext(), GetEntityId());
		if (!cmpFootprint)
		{
			// Default (this probably shouldn't happen) - just render an arbitrary-sized circle
			SimRender::ConstructCircleOnGround(GetSimContext(), x, z, 2.f, m_Overlay, cmpPosition->IsFloating());
		}
		else
		{
			ICmpFootprint::EShape shape;
			entity_pos_t size0, size1, height;
			cmpFootprint->GetShape(shape, size0, size1, height);

			if (shape == ICmpFootprint::SQUARE)
				SimRender::ConstructSquareOnGround(GetSimContext(), x, z, size0.ToFloat(), size1.ToFloat(), rotY, m_Overlay, cmpPosition->IsFloating());
			else
				SimRender::ConstructCircleOnGround(GetSimContext(), x, z, size0.ToFloat(), m_Overlay, cmpPosition->IsFloating());
		}
	}
开发者ID:Gallaecio,项目名称:0ad,代码行数:30,代码来源:CCmpSelectable.cpp

示例5: ProcessEvent

	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{
		switch(event)
		{
		case eFE_Initialize:
			m_actInfo = *pActInfo;
			CMiniMapInfo::GetInstance()->UpdateLevelInfo();
			m_entityId = GetEntityId(pActInfo);
			break;

		case eFE_Activate:
			if(IsPortActive(pActInfo, eI_Trigger))
				TriggerPorts(pActInfo);

			if(IsPortActive(pActInfo, eI_Disable))
				UnRegisterEntity();

			if(IsPortActive(pActInfo, eI_Enable))
			{
				UnRegisterEntity();
				m_entityId = GetEntityId(pActInfo);
				RegisterEntity();
			}

			break;
		}
	}
开发者ID:Hellraiser666,项目名称:CryGame,代码行数:27,代码来源:FlowMinimapNodes.cpp

示例6: assert

//------------------------------------------------------------------------
void CVehicleWeapon::StartUse(EntityId userId)
{
	if (m_ownerId && userId != m_ownerId)
		return; 

  if (GetEntity()->GetParent())
  { 
    m_pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(GetEntity()->GetParent()->GetId());
    assert(m_pVehicle && "Using VehicleWeapons on non-vehicles may lead to unexpected behavior.");

    if (m_pVehicle)
    {   
      m_pPart = m_pVehicle->GetWeaponParentPart(GetEntityId()); 
      m_pOwnerSeat = m_pVehicle->GetWeaponParentSeat(GetEntityId());
      m_pSeatUser = m_pVehicle->GetSeatForPassenger(userId);
    }
  }
  
	SetOwnerId(userId);
  Select(true);	
	m_stats.used = true;

	EnableUpdate(true, eIUS_General);
	RequireUpdate(eIUS_General);

  if (OutOfAmmo(false))
    Reload(false);

  UseManualBlending(true);

	LowerWeapon(false);

	SendMusicLogicEvent(eMUSICLOGICEVENT_WEAPON_MOUNT);

}
开发者ID:kitnet,项目名称:crynegine,代码行数:36,代码来源:VehicleWeapon.cpp

示例7: HandleMessage

	virtual void HandleMessage(const CMessage& msg, bool UNUSED(global))
	{
		switch (msg.GetType())
		{
		case MT_PositionChanged:
		{
			if (!m_Active)
				break;

			const CMessagePositionChanged& data = static_cast<const CMessagePositionChanged&> (msg);

			if (!data.inWorld && !m_Tag.valid())
				break; // nothing needs to change

			CmpPtr<ICmpObstructionManager> cmpObstructionManager(GetSimContext(), SYSTEM_ENTITY);
			if (!cmpObstructionManager)
				break; // error

			if (data.inWorld && m_Tag.valid())
			{
				cmpObstructionManager->MoveShape(m_Tag, data.x, data.z, data.a);
			}
			else if (data.inWorld && !m_Tag.valid())
			{
				// Need to create a new pathfinder shape:
				if (m_Type == STATIC)
					m_Tag = cmpObstructionManager->AddStaticShape(GetEntityId(),
						data.x, data.z, data.a, m_Size0, m_Size1, m_Flags, m_ControlGroup, m_ControlGroup2);
				else
					m_Tag = cmpObstructionManager->AddUnitShape(GetEntityId(),
						data.x, data.z, m_Size0, (flags_t)(m_Flags | (m_Moving ? ICmpObstructionManager::FLAG_MOVING : 0)), m_ControlGroup);
			}
			else if (!data.inWorld && m_Tag.valid())
			{
				cmpObstructionManager->RemoveShape(m_Tag);
				m_Tag = tag_t();
			}
			break;
		}
		case MT_Destroy:
		{
			if (m_Tag.valid())
			{
				CmpPtr<ICmpObstructionManager> cmpObstructionManager(GetSimContext(), SYSTEM_ENTITY);
				if (!cmpObstructionManager)
					break; // error

				cmpObstructionManager->RemoveShape(m_Tag);
				m_Tag = tag_t();
			}
			break;
		}
		}
	}
开发者ID:TiriliPiitPiit,项目名称:0ad,代码行数:54,代码来源:CCmpObstruction.cpp

示例8: Init

	virtual void Init(const CParamNode& paramNode)
	{
		m_PreviouslyRendered = false;
		m_Unit = NULL;
		m_Visibility = ICmpRangeManager::VIS_HIDDEN;

		m_R = m_G = m_B = fixed::FromInt(1);

		if (!GetSimContext().HasUnitManager())
			return; // do nothing further if graphics are disabled

		// TODO: we should do some fancy animation of under-construction buildings rising from the ground,
		// but for now we'll just use the foundation actor and ignore the normal one
		if (paramNode.GetChild("Foundation").IsOk() && paramNode.GetChild("FoundationActor").IsOk())
			m_ActorName = paramNode.GetChild("FoundationActor").ToString();
		else
			m_ActorName = paramNode.GetChild("Actor").ToString();

		std::set<CStr> selections;
		m_Unit = GetSimContext().GetUnitManager().CreateUnit(m_ActorName, GetActorSeed(), selections);
		if (m_Unit)
		{
			CModelAbstract& model = m_Unit->GetModel();
			if (model.ToCModel())
			{
				u32 modelFlags = 0;

				if (paramNode.GetChild("SilhouetteDisplay").ToBool())
					modelFlags |= MODELFLAG_SILHOUETTE_DISPLAY;

				if (paramNode.GetChild("SilhouetteOccluder").ToBool())
					modelFlags |= MODELFLAG_SILHOUETTE_OCCLUDER;

				CmpPtr<ICmpVision> cmpVision(GetSimContext(), GetEntityId());
				if (cmpVision && cmpVision->GetAlwaysVisible())
					modelFlags |= MODELFLAG_IGNORE_LOS;

				model.ToCModel()->AddFlagsRec(modelFlags);
			}

			// Initialize the model's selection shape descriptor. This currently relies on the component initialization order; the 
			// Footprint component must be initialized before this component (VisualActor) to support the ability to use the footprint
			// shape for the selection box (instead of the default recursive bounding box). See TypeList.h for the order in
			// which components are initialized; if for whatever reason you need to get rid of this dependency, you can always just
			// initialize the selection shape descriptor on-demand.
			InitSelectionShapeDescriptor(model, paramNode);

			m_Unit->SetID(GetEntityId());
		}

		SelectAnimation("idle", false, fixed::FromInt(1), L"");
	}
开发者ID:stonefruit,项目名称:0ad,代码行数:52,代码来源:CCmpVisualActor.cpp

示例9: SetActive

	virtual void SetActive(bool active)
	{
		if (active && !m_Active)
		{
			m_Active = true;

			// Construct the obstruction shape

			CmpPtr<ICmpObstructionManager> cmpObstructionManager(GetSystemEntity());
			if (!cmpObstructionManager)
				return; // error

			CmpPtr<ICmpPosition> cmpPosition(GetEntityHandle());
			if (!cmpPosition)
				return; // error

			if (!cmpPosition->IsInWorld())
				return; // don't need an obstruction

			// TODO: code duplication from message handlers
			CFixedVector2D pos = cmpPosition->GetPosition2D();
			if (m_Type == STATIC)
				m_Tag = cmpObstructionManager->AddStaticShape(GetEntityId(),
					pos.X, pos.Y, cmpPosition->GetRotation().Y, m_Size0, m_Size1, m_Flags, m_ControlGroup, m_ControlGroup2);
			else if (m_Type == UNIT)
				m_Tag = cmpObstructionManager->AddUnitShape(GetEntityId(),
					pos.X, pos.Y, m_Size0, m_Clearance, (flags_t)(m_Flags | (m_Moving ? ICmpObstructionManager::FLAG_MOVING : 0)), m_ControlGroup);
			else 
				AddClusterShapes(pos.X, pos.Y, cmpPosition->GetRotation().Y);
		}
		else if (!active && m_Active)
		{
			m_Active = false;

			// Delete the obstruction shape

			// TODO: code duplication from message handlers
			if (m_Tag.valid())
			{
				CmpPtr<ICmpObstructionManager> cmpObstructionManager(GetSystemEntity());
				if (!cmpObstructionManager)
					return; // error

				cmpObstructionManager->RemoveShape(m_Tag);
				m_Tag = tag_t();
				if (m_Type == CLUSTER)
					RemoveClusterShapes();
			}
		}
		// else we didn't change the active status
	}
开发者ID:zxbstrong,项目名称:0ad,代码行数:51,代码来源:CCmpObstruction.cpp

示例10:

//------------------------------------------------------------------------
CClaymore::~CClaymore()
{
	if(gEnv->bMultiplayer && gEnv->bServer)
	{
		IActor *pOwner = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(m_ownerId);
		if(pOwner && pOwner->IsPlayer())
		{
			((CPlayer*)pOwner)->RecordExplosiveDestroyed(GetEntityId(), 0);
		}
	}

	if(g_pGame->GetHUD())
		g_pGame->GetHUD()->RecordExplosiveDestroyed(GetEntityId());
}
开发者ID:RenEvo,项目名称:dead6,代码行数:15,代码来源:Claymore.cpp

示例11: dir

//------------------------------------------------------------------------
void CRock::HandleEvent(const SGameObjectEvent &event)
{
	CProjectile::HandleEvent(event);

	if (event.event == eGFE_OnCollision)
	{
		if (m_destroying)
			return;

		EventPhysCollision *pCollision = reinterpret_cast<EventPhysCollision *>(event.ptr);
		if (!pCollision)
			return;

		IEntity *pTarget = pCollision->iForeignData[1]==PHYS_FOREIGN_ID_ENTITY ? (IEntity*)pCollision->pForeignData[1]:0;

		if (!pTarget || pTarget->GetId()==m_ownerId || pTarget->GetId()==GetEntityId())
			return;

		Vec3 dir(0, 0, 0);
		if (pCollision->vloc[0].GetLengthSquared() > 1e-6f)
			dir = pCollision->vloc[0].GetNormalized();

		CGameRules *pGameRules = g_pGame->GetGameRules();

		HitInfo hitInfo(m_ownerId, pTarget?pTarget->GetId():0, m_weaponId,
			m_fmId, 0.0f, pGameRules->GetHitMaterialIdFromSurfaceId(pCollision->idmat[1]), pCollision->partid[1],
			pGameRules->GetHitTypeId("melee"), pCollision->pt, dir, pCollision->n);

		hitInfo.remote = IsRemote();
		hitInfo.projectileId = GetEntityId();
		if (!hitInfo.remote)
			hitInfo.seq=m_seq;
		hitInfo.damage = m_damage;

		if (m_weaponId)
		{
			CWeapon *pWeapon=GetWeapon();
			if (pWeapon && pWeapon->GetForcedHitMaterial() != -1)
				hitInfo.material=pGameRules->GetHitMaterialIdFromSurfaceId(pWeapon->GetForcedHitMaterial());
		}

		pGameRules->ClientHit(hitInfo);

		if(m_damage>10)
			m_damage =(int)(m_damage*0.5f);

	}
}
开发者ID:mrwonko,项目名称:CrysisVR,代码行数:49,代码来源:Rock.cpp

示例12: GetActor

//=========================================
bool CRocketLauncher::CanPickUp(EntityId userId) const
{
	CActor *pActor = GetActor(userId);
	IInventory *pInventory=GetActorInventory(pActor);

	if (m_sharedparams->params.pickable && m_stats.pickable && !m_stats.flying && !m_frozen &&(!m_ownerId || m_ownerId==userId) && !m_stats.selected && !GetEntity()->IsHidden())
	{
		if (pInventory && pInventory->FindItem(GetEntityId())!=-1)
			return false;
	}
	else
		return false;

	uint8 uniqueId = m_pItemSystem->GetItemUniqueId(GetEntity()->GetClass()->GetName());

	//Can not pick up a LAW while I have one already 
	if(pInventory && (pInventory->GetCountOfUniqueId(uniqueId)>0))
	{
		if(pActor->IsClient())
			g_pGame->GetGameRules()->OnTextMessage(eTextMessageCenter, "@mp_CannotCarryMoreLAW");
		return false;
	}

	return true;
		
}
开发者ID:nhnam,项目名称:Seasons,代码行数:27,代码来源:RocketLauncher.cpp

示例13: InstallProceduralClip

void CActionScope::InstallProceduralClip(const SProceduralEntry &proc, int layer, const SAnimBlend &blend, float duration)
{
    SProcSequencer &procSeq = m_procSequencers[layer];
    if (procSeq.proceduralClip)
    {
        procSeq.proceduralClip->OnExit(blend.duration);
        procSeq.proceduralClip.reset();
    }
    if (proc.type != 0)
    {
        CryCreateClassInstance<IProceduralClip>(proc.typeString.c_str(), procSeq.proceduralClip);

        if (procSeq.proceduralClip)
        {
            const char *contextName = procSeq.proceduralClip->GetContextName();

            if (contextName)
            {
                IProceduralContext *context = m_actionController.FindOrCreateProceduralContext(contextName);
                procSeq.proceduralClip->SetContext(context);
            }

            IEntity* pEntity = gEnv->pEntitySystem->GetEntity(GetEntityId()); // TODO: Handle invalid entity!
            procSeq.proceduralClip->Initialise(*pEntity, *GetCharInst(), *this, *m_pAction);
            procSeq.proceduralClip->INTERNAL_OnEnter(blend.duration, duration, *((SProceduralParams*)&proc.animRef));
        }
    }
}
开发者ID:souxiaosou,项目名称:FireNET,代码行数:28,代码来源:ActionScope.cpp

示例14: RenderSubmit

	void RenderSubmit(SceneCollector& collector)
	{
		// (This is only called if a > 0)
		collector.Submit(&m_Overlay);

		if (ICmpSelectable::ms_EnableDebugOverlays)
		{
			// allocate debug overlays on-demand
			if (!m_DebugBoundingBoxOverlay) m_DebugBoundingBoxOverlay = new SOverlayLine;
			if (!m_DebugSelectionBoxOverlay) m_DebugSelectionBoxOverlay = new SOverlayLine;

			CmpPtr<ICmpVisual> cmpVisual(GetSimContext(), GetEntityId()); 
			if (cmpVisual) 
			{
				SimRender::ConstructBoxOutline(cmpVisual->GetBounds(), *m_DebugBoundingBoxOverlay);
				m_DebugBoundingBoxOverlay->m_Thickness = 2; 
				m_DebugBoundingBoxOverlay->m_Color = CColor(1.f, 0.f, 0.f, 1.f);

				SimRender::ConstructBoxOutline(cmpVisual->GetSelectionBox(), *m_DebugSelectionBoxOverlay);
				m_DebugSelectionBoxOverlay->m_Thickness = 2;
				m_DebugSelectionBoxOverlay->m_Color = CColor(0.f, 1.f, 0.f, 1.f);

				collector.Submit(m_DebugBoundingBoxOverlay);
				collector.Submit(m_DebugSelectionBoxOverlay);
			}
		}
		else
		{
			// reclaim debug overlay line memory when no longer debugging (and make sure to set to zero after deletion)
			if (m_DebugBoundingBoxOverlay) SAFE_DELETE(m_DebugBoundingBoxOverlay);
			if (m_DebugSelectionBoxOverlay) SAFE_DELETE(m_DebugSelectionBoxOverlay);
		}
	}
开发者ID:Gallaecio,项目名称:0ad,代码行数:33,代码来源:CCmpSelectable.cpp

示例15: ZapEnemiesOnPuddle

void CWaterPuddle::ZapEnemiesOnPuddle(int ownTeam, EntityId shooterId, EntityId weaponId, float damage, int hitTypeId, IParticleEffect* hitEffect)
{
	IGameVolumes::VolumeInfo volumeInfo;
	if (!GetVolumeInfoForEntity(GetEntityId(), &volumeInfo))
		return;
	IEntity* pEntity = GetEntity();
	Matrix34 worldTM = pEntity->GetWorldTM();
	float waterLevel = worldTM.GetTranslation().z + volumeInfo.volumeHeight * 0.5f;

	CActorManager* pActorManager = CActorManager::GetActorManager();
	const int numberOfActors	= pActorManager->GetNumActors();

	for(int i = 0; i < numberOfActors; i++)
	{
		SActorData actorData;
		pActorManager->GetNthActorData(i, actorData);

		bool isActorAlive = (actorData.health > 0.0f);
		bool isActorEnemy = (actorData.teamId != ownTeam);
		bool isActorInsidevolume = IsActorInsideVolume(worldTM, volumeInfo, actorData.entityId);

		if (isActorAlive && isActorEnemy && isActorInsidevolume)
			ApplyHit(actorData, shooterId, weaponId, damage, hitTypeId, waterLevel, hitEffect);
	}
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:25,代码来源:WaterPuddle.cpp


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