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


C++ IActor::GetEntityId方法代码示例

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


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

示例1: OnVehicleEvent

//------------------------------------------------------------------------
void CVehicleActionDeployRope::OnVehicleEvent(EVehicleEvent event, const SVehicleEventParams& params)
{
	if (event == eVE_PassengerExit && params.iParam == m_seatId)
	{
		IActorSystem* pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
		assert(pActorSystem);

		IActor* pActor = pActorSystem->GetActor(params.entityId);
		if (!pActor)
		{
			assert(pActor);
			return;
		}

		m_actorId = pActor->GetEntityId();

		DeployRope();
		AttachOnRope(pActor->GetEntity());
	} 
	else if (event == eVE_Destroyed)
	{
		if (m_ropeUpperId)
		{
			gEnv->pEntitySystem->RemoveEntity(m_ropeUpperId);
			m_ropeUpperId = 0;
		}

		if (m_ropeLowerId)
		{
			gEnv->pEntitySystem->RemoveEntity(m_ropeLowerId);
			m_ropeLowerId = 0;
		}
	}
}
开发者ID:MrHankey,项目名称:destructionderby,代码行数:35,代码来源:VehicleActionDeployRope.cpp

示例2: Update

//------------------------------------------------------------------------
void CProjectile::Update(SEntityUpdateContext &ctx, int updateSlot)
{
	FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);

	if (updateSlot!=0)
		return;

	float color[4] = {1,1,1,1};
	bool bDebug = g_pGameCVars->i_debug_projectiles > 0;

	if(bDebug)
		gEnv->pRenderer->Draw2dLabel(50,15,2.0f,color,false,"Projectile: %s",GetEntity()->GetClass()->GetName());

	Vec3 pos = GetEntity()->GetWorldPos();

	ScaledEffect(m_pAmmoParams->pScaledEffect);

	// update whiz
	if(m_pAmmoParams->pWhiz)
	{
		if (m_whizSoundId == INVALID_SOUNDID)
		{
			IActor *pActor = g_pGame->GetIGameFramework()->GetClientActor();
			if (pActor && (m_ownerId != pActor->GetEntityId()))
			{
				float probability = 0.85f;

				if (Random()<=probability)
				{
					Lineseg line(m_last, pos);
					Vec3 player = pActor->GetEntity()->GetWorldPos();

					float t;
					float distanceSq=Distance::Point_LinesegSq(player, line, t);

					if (distanceSq < 4.7f*4.7f && (t>=0.0f && t<=1.0f))
					{
						if (distanceSq >= 0.65*0.65)
						{
							Sphere s;
							s.center = player;
							s.radius = 4.7f;

							Vec3 entry,exit;
							int intersect=Intersect::Lineseg_Sphere(line, s, entry,exit);
							if (intersect==0x1 || intersect==0x3) // one entry or one entry and one exit
								WhizSound(true, entry, (pos-m_last).GetNormalized());
						}
					}
				}
			}
		}
	}

	if (m_trailSoundId==INVALID_SOUNDID)
		TrailSound(true);

	m_totalLifetime += ctx.fFrameTime;
	m_last = pos;
}
开发者ID:mrwonko,项目名称:CrysisVR,代码行数:61,代码来源:Projectile.cpp

示例3: ProcessEvent

	virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
		case eFE_Activate:
			{
				IActorSystem *pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
				IActorIteratorPtr actorIt = pActorSystem->CreateActorIterator();
				int iNumPlayers = 0;
				IActor *pActor = actorIt->Next();
				while(iNumPlayers < 4 && pActor)
				{
					if(pActor->GetChannelId())
					{
						ActivateOutput(pActInfo, iNumPlayers, pActor->GetEntityId());
						++iNumPlayers;
					}

					pActor = actorIt->Next();
				}
			}
			break;
		}
	}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:25,代码来源:FlowGameNodes.cpp

示例4: IsFriendlyEntity

bool CHUDCrosshair::IsFriendlyEntity(IEntity *pEntity)
{
	IActor *pClientActor = g_pGame->GetIGameFramework()->GetClientActor();
	CGameRules *pGameRules = g_pGame->GetGameRules();

	if(!pEntity || !pClientActor || !pGameRules)
		return false;

	// Less than 2 teams means we are in a FFA based game.
	if(pGameRules->GetTeamCount() < 2)
		return false;

	bool bFriendly = false;

	int iClientTeam = pGameRules->GetTeam(pClientActor->GetEntityId());

	// First, check if entity is a player
	IActor *pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pEntity->GetId());
	if(pActor && pActor->IsPlayer())
	{
		if(iClientTeam && (pGameRules->GetTeam(pActor->GetEntityId()) == iClientTeam))
		{
			bFriendly = true;
		}
	}
	else
	{
		// Then, check if entity is a vehicle
		IVehicle *pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(pEntity->GetId());
		if(pVehicle && pGameRules->GetTeam(pVehicle->GetEntityId()) == iClientTeam && pVehicle->GetStatus().passengerCount)
		{
			IActor *pDriver = pVehicle->GetDriver();
			/*if(pDriver && pGameRules->GetTeam(pDriver->GetEntityId()) == iClientTeam)
				bFriendly = true;
			else
				bFriendly = false;*/

			bFriendly = true;

			//fix for bad raycast
			if(pDriver && pDriver == pClientActor)
				bFriendly = false;
		}
	}

  return bFriendly;
}
开发者ID:mrwonko,项目名称:CrysisVR,代码行数:47,代码来源:HUDCrosshair.cpp

示例5: Execute

void CMFXParticleEffect::Execute(const SMFXRunTimeEffectParams& params)
{
  FUNCTION_PROFILER(gEnv->pSystem, PROFILE_ACTION);

  Vec3 pos = params.pos;
	Vec3 dir = ZERO;
	Vec3 inDir = params.dir[0];
	Vec3 reverso = inDir * -1.0f;
	switch (m_particleParams.directionType)
	{
	case SMFXParticleParams::eDT_Normal:
		dir = params.normal;
		break;
	case SMFXParticleParams::eDT_Ricochet:
		dir = reverso.GetRotated(params.normal, gf_PI).normalize();
		break;
	default:
		dir = params.normal;
		break;
	}
 
  bool tryToAttachEffect = (CMaterialEffectsCVars::Get().mfx_EnableAttachedEffects != 0);
  float distToPlayer = 0.f;
  IActor *pClientActor = gEnv->pGame->GetIGameFramework()->GetClientActor();
  if (pClientActor)
  {
    distToPlayer = (pClientActor->GetEntity()->GetWorldPos() - params.pos).GetLength();
	tryToAttachEffect = tryToAttachEffect && (pClientActor->GetEntityId() != params.trg);
  }
  
  SMFXParticleEntries::const_iterator end = m_particleParams.m_entries.end();
  for (SMFXParticleEntries::const_iterator it = m_particleParams.m_entries.begin(); it!=end; ++it)
  {
    // choose effect based on distance
    if ((it->maxdist == 0.f) || (distToPlayer <= it->maxdist) && !it->name.empty() )
    { 
      IParticleEffect *pParticle = gEnv->pParticleManager->FindEffect(it->name.c_str());

      if (pParticle)
      {
        const float pfx_minscale = (it->minscale != 0.f) ? it->minscale : CMaterialEffectsCVars::Get().mfx_pfx_minScale;
        const float pfx_maxscale = (it->maxscale != 0.f) ? it->maxscale : CMaterialEffectsCVars::Get().mfx_pfx_maxScale; 
        const float pfx_maxdist = (it->maxscaledist != 0.f) ? it->maxscaledist : CMaterialEffectsCVars::Get().mfx_pfx_maxDist; 
                
        const float truscale = pfx_minscale + ((pfx_maxscale - pfx_minscale) * (distToPlayer!=0.f ? min(1.0f, distToPlayer/pfx_maxdist) : 1.f));  

		bool particleSpawnedAndAttached = tryToAttachEffect ? AttachToTarget(*it, params, pParticle, dir, truscale) : false;

        // If not attached, just spawn the particle
		if (particleSpawnedAndAttached == false)
		{
			pParticle->Spawn( true, IParticleEffect::ParticleLoc(pos, dir, truscale) );
		}
      }
      
      break;
    }
  }
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:59,代码来源:MFXParticleEffect.cpp

示例6: UpdateEntityIdOutput

	bool UpdateEntityIdOutput( SActivationInfo *pActInfo )	
	{
		IActor * pActor = CCryAction::GetCryAction()->GetClientActor();
		if (pActor)
		{
			ActivateOutput(pActInfo, 0, pActor->GetEntityId());
			return true;
		}
		else
			return false;
	}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:11,代码来源:FlowGameNodes.cpp

示例7: OnShoot

// IWeaponEventListener
//---------------------------------------
void CMiscAnnouncer::OnShoot(IWeapon *pWeapon, EntityId shooterId, EntityId ammoId, IEntityClass* pAmmoType, const Vec3 &pos, const Vec3 &dir, const Vec3 &vel)
{
	if(!ma_enabled || !AnnouncerRequired())
		return;

	CWeapon *pWeaponImpl = static_cast<CWeapon*>(pWeapon);
	IEntityClass *pWeaponEntityClass = pWeaponImpl->GetEntity()->GetClass();
	g_pGame->GetWeaponSystem()->GetWeaponAlias().UpdateClass(&pWeaponEntityClass);

	DbgLog("CMiscAnnouncer::OnShoot() pWeaponImpl=%s; shooter=%d; pAmmoType=%s", pWeaponImpl->GetEntity()->GetName(), g_pGame->GetGameRules()->GetEntityName(shooterId), pAmmoType->GetName());
	
	TWeaponFiredMap::iterator it = m_weaponFiredMap.find(pWeaponEntityClass);
	if(it != m_weaponFiredMap.end())
	{
		SOnWeaponFired &onWeaponFired = it->second;

		DbgLog("CMiscAnnouncer::OnShoot() has found the firing weaponClass in our weaponFiredMap. With announcement=%s", onWeaponFired.m_announcementName.c_str());

		// we only want to play the announcement once each game/round
		IActor *pClientActor = gEnv->pGame->GetIGameFramework()->GetClientActor();
		CGameRules *pGameRules = g_pGame->GetGameRules();
		int clientTeam = pGameRules->GetTeam(pClientActor->GetEntityId());
		int shooterTeam = pGameRules->GetTeam(shooterId);
		
		if (clientTeam == shooterTeam)
		{
			if (!onWeaponFired.m_havePlayedFriendly)
			{
				DbgLog("CMiscAnnouncer::OnShoot() we've not played this friendly annoucement already. Let's do it");
				CAnnouncer::GetInstance()->Announce(shooterId, onWeaponFired.m_announcementID, CAnnouncer::eAC_inGame);
			}
			else
			{
				DbgLog("CMiscAnnouncer::OnShoot() we've already played this friendly announcement. Not playing again");
			}
			onWeaponFired.m_havePlayedFriendly = true;
		}
		else
		{
			if (!onWeaponFired.m_havePlayedEnemy)
			{
				DbgLog("CMiscAnnouncer::OnShoot() we've not played this enemy announcement already. Let's do it");
				CAnnouncer::GetInstance()->Announce(shooterId, onWeaponFired.m_announcementID, CAnnouncer::eAC_inGame);
			}
			else
			{
				DbgLog("CMiscAnnouncer::OnShoot() we've already played this enemy announcement. Not playing again.");
			}
			onWeaponFired.m_havePlayedEnemy = true;
		}
	}
}
开发者ID:eBunny,项目名称:EmberProject,代码行数:54,代码来源:MiscAnnouncer.cpp

示例8: ClProcessHit

//------------------------------------------------------------------------
void CGameRulesCommonDamageHandling::ClProcessHit(Vec3 dir, EntityId shooterId, EntityId weaponId, float damage, uint16 projectileClassId, uint8 hitTypeId)
{
	const char* hit = g_pGame->GetGameRules()->GetHitType(hitTypeId);
	if(hit)
	{
		IActor *pClientActor = gEnv->pGame->GetIGameFramework()->GetClientActor();
		string hitSound;
		hitSound.Format("ClientDamage%s", hit);
		float maxHealth = pClientActor->GetMaxHealth();
		float normalizedDamage = SATURATE(maxHealth > 0.0f ? damage / maxHealth : 0.0f);
		CAudioSignalPlayer::JustPlay(hitSound.c_str(), pClientActor->GetEntityId(), "damage", normalizedDamage);
	}
}
开发者ID:aronarts,项目名称:FireNET,代码行数:14,代码来源:GameRulesCommonDamageHandling.cpp

示例9: InitClient

void CHeavyWeapon::InitClient( int channelId )
{
    BaseClass::InitClient(channelId);

    IActor *pActor = GetOwnerActor();
    if(pActor && pActor->GetChannelId() != channelId)
        {
            EntityId ownerId = pActor->GetEntityId();
            GetGameObject()->InvokeRMIWithDependentObject(ClHeavyWeaponUsed(), SHeavyWeaponUserParams(ownerId), eRMI_ToClientChannel, ownerId, channelId);
        }
    else if(m_bIsHighlighted)
        {
            GetGameObject()->InvokeRMI(ClHeavyWeaponHighlighted(), SNoParams(), eRMI_ToClientChannel, channelId);
        }
}
开发者ID:eBunny,项目名称:EmberProject,代码行数:15,代码来源:HeavyWeapon.cpp

示例10: Update

//------------------------------------------------------------------------
void CShake::Update(SEntityUpdateContext &ctx, int updateSlot)
{
	IActor *pClient = g_pGame->GetIGameFramework()->GetClientActor();
	if (pClient)
	{
		float dist2ToClient((pClient->GetEntity()->GetWorldPos() - GetEntity()->GetWorldPos()).len2());
		float maxRange(m_radius * m_radius);
		if (dist2ToClient<maxRange)
		{
			IView *pView = g_pGame->GetIGameFramework()->GetIViewSystem()->GetViewByEntityId(pClient->GetEntityId());
			if (pView)
			{
				float strength = (1.0f - (dist2ToClient/maxRange)) * 0.5f;
				pView->SetViewShake(ZERO,Vec3(m_shake*strength,0,m_shake*strength),0.1f,0.0225f,1.5f,1);
			}
		}
	}
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:19,代码来源:Shake.cpp

示例11: ClientHit

//------------------------------------------------------------------------
void CGameRules::ClientHit(const HitInfo &hitInfo)
{
	FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);

	IActor *pClientActor = g_pGame->GetIGameFramework()->GetClientActor();
	IEntity *pTarget = m_pEntitySystem->GetEntity(hitInfo.targetId);
	IEntity *pShooter =	m_pEntitySystem->GetEntity(hitInfo.shooterId);
	IVehicle *pVehicle = g_pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(hitInfo.targetId);
	IActor *pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(hitInfo.targetId);
	bool dead = pActor?(pActor->GetHealth()<=0):false;

	if((pClientActor && pClientActor->GetEntity()==pShooter) && pTarget && (pVehicle || pActor) && !dead)
	{
		SAFE_HUD_FUNC(GetCrosshair()->CrosshairHit());
		SAFE_HUD_FUNC(GetTagNames()->AddEnemyTagName(pActor?pActor->GetEntityId():pVehicle->GetEntityId()));
	}

	if(pActor == pClientActor)
		if (gEnv->pInput) gEnv->pInput->ForceFeedbackEvent( SFFOutputEvent(eDI_XI, eFF_Rumble_Basic, 0.5f * hitInfo.damage * 0.01f, hitInfo.damage * 0.02f, 0.0f));

/*	if (gEnv->pAISystem && !gEnv->bMultiplayer)
	{
		static int htMelee = GetHitTypeId("melee");
		if (pShooter && hitInfo.type != htMelee)
		{
			ISurfaceType *pSurfaceType = GetHitMaterial(hitInfo.material);
			const ISurfaceType::SSurfaceTypeAIParams* pParams = pSurfaceType ? pSurfaceType->GetAIParams() : 0;
			const float radius = pParams ? pParams->fImpactRadius : 5.0f;
			gEnv->pAISystem->BulletHitEvent(hitInfo.pos, radius, pShooter->GetAI());
		}
	}*/

	CreateScriptHitInfo(m_scriptHitInfo, hitInfo);
	CallScript(m_clientStateScript, "OnHit", m_scriptHitInfo);

	bool backface = hitInfo.dir.Dot(hitInfo.normal)>0;
	if (!hitInfo.remote && hitInfo.targetId && !backface)
	{
		if (!gEnv->bServer)
			GetGameObject()->InvokeRMI(SvRequestHit(), hitInfo, eRMI_ToServer);
		else
			ServerHit(hitInfo);
	}
}
开发者ID:RenEvo,项目名称:dead6,代码行数:45,代码来源:GameRulesClientServer.cpp

示例12: OnUserLeftLobby

//------------------------------------------------------------------------
void CGameRules::OnUserLeftLobby(int channelId)
{
	if (g_pGame->GetHostMigrationState() == CGame::eHMS_WaitingForPlayers)
	{
		int migratingIndex = GetMigratingPlayerIndex(channelId);
		if (migratingIndex >= 0)
		{
			// Migrating player has left the lobby so they aren't going to make the migration, remove them

			FinishMigrationForPlayer(migratingIndex);

			IActor *pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActorByChannelId(channelId);
			if (pActor)
			{
				FakeDisconnectPlayer(pActor->GetEntityId());
			}
		}
	}
}
开发者ID:MrHankey,项目名称:Tanks,代码行数:20,代码来源:GameRulesHostMigration.cpp

示例13: CanZoom

//------------------------------------------------------------------------
bool CVehicleMountedWeapon::CanZoom() const
{
	if (!CHeavyMountedWeapon::CanZoom())
		return false;

	IVehicle *pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(m_vehicleId);
	if(pVehicle && !IsRippedOff())
	{
		if (m_pSeatUser != m_pOwnerSeat)
			return false;

		IActor* pActor = GetOwnerActor();
		IVehicleSeat* pSeat = pActor ? pVehicle->GetSeatForPassenger(pActor->GetEntityId()) : NULL;
		IVehicleView* pView = pSeat ? pSeat->GetCurrentView() : NULL;
		if (pView && pView->IsThirdPerson())
			return false;
	}

	return true;
}
开发者ID:amrhead,项目名称:eaascode,代码行数:21,代码来源:VehicleMountedWeapon.cpp

示例14: IsFriendlyToClient

bool CHUDTagNames::IsFriendlyToClient(EntityId uiEntityId)
{
	IActor *client = g_pGame->GetIGameFramework()->GetClientActor();
	CGameRules *pGameRules = g_pGame->GetGameRules();
	if(!client || !pGameRules)
		return false;

	int playerTeam = pGameRules->GetTeam(client->GetEntityId());

	// if this actor is spectating, use the team of the player they are spectating instead...
	if(static_cast<CActor*>(client)->GetSpectatorMode() == CActor::eASM_Follow)
	{
		playerTeam = pGameRules->GetTeam(static_cast<CActor*>(client)->GetSpectatorTarget());
	}

	// Less than 2 teams means we are in a FFA based game.
	if(pGameRules->GetTeam(uiEntityId) == playerTeam && pGameRules->GetTeamCount() > 1)
		return true;
	return false;
}
开发者ID:RenEvo,项目名称:dead6,代码行数:20,代码来源:HUDTagNames.cpp

示例15: CanZoom

//------------------------------------------------------------------------
bool CVehicleWeapon::CanZoom() const
{
  if (!CWeapon::CanZoom())
    return false;

  if (!m_bOwnerInSeat)
    return false;

	IVehicle *pVehicle = GetVehicle();
	if(!pVehicle)
		return false;

  IActor* pActor = GetOwnerActor();
	IVehicleSeat* pSeat = pActor ? pVehicle->GetSeatForPassenger(pActor->GetEntityId()) : NULL;
	IVehicleView* pView = pSeat ? pSeat->GetCurrentView() : NULL;
  if (pView && pView->IsThirdPerson())
    return false;

  return true;
}
开发者ID:amrhead,项目名称:eaascode,代码行数:21,代码来源:VehicleWeapon.cpp


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