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


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

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


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

示例1: ActivateLight

//-------------------------------------------------------------------------
void CLam::ActivateLight(bool activate, bool aiRequest /* = false */)
{
    //GameWarning("CLam::ActivateLight(%i)", activate);

    CItem  *pParent = NULL;
    EntityId ownerId = 0;

    if (IItem *pOwnerItem = m_pItemSystem->GetItem(GetParentId()))
    {
        pParent = (CItem *)pOwnerItem;
        IWeapon *pWeapon = pOwnerItem->GetIWeapon();
        if(pWeapon)
            ownerId = pOwnerItem->GetOwnerId();
    }
    else
    {
        pParent = this;
        ownerId = GetOwnerId();
    }

    IActor *pOwnerActor = gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(ownerId);
    if (activate && !pOwnerActor)
        return;

    //Special FP stuff
    if(pOwnerActor && pOwnerActor->IsPlayer() && !m_lamparams.isFlashLight)
        return;

    //For AI must be deactivated by default (if they don't request)
    if(activate && !m_lightWasOn && !aiRequest && !pOwnerActor->IsPlayer())
        return;

    m_lightActivated = activate;

    //Activate or deactivate effect
    if (!m_lightActivated)
    {
        AttachLAMLight(false, pParent, eIGS_FirstPerson);
        AttachLAMLight(false, pParent, eIGS_ThirdPerson);

        //GameWarning("Global light count = %d", s_lightCount);
    }
    else
    {
        uint8 id = pOwnerActor->IsThirdPerson() ? 1 : 0;
        if (m_lightID[id] == 0)
        {
            AttachLAMLight(true, pParent, id?eIGS_ThirdPerson:eIGS_FirstPerson);
        }
    }

    if (m_laserActivated || m_lightActivated)
        GetGameObject()->EnablePostUpdates(this);
    if (!m_laserActivated && !m_lightActivated)
        GetGameObject()->DisablePostUpdates(this);

}
开发者ID:j30206868,项目名称:NetWars_cpp,代码行数:58,代码来源:Lam.cpp

示例2: RefGun

//------------------------------------------------------------------------
void CWeaponSystem::RefGun(IConsoleCmdArgs *args)
{
	IGameFramework *pGF = gEnv->pGame->GetIGameFramework();
	IItemSystem *pItemSystem = pGF->GetIItemSystem();

	IActor *pActor = pGF->GetClientActor();

	if(!pActor || !pActor->IsPlayer())
		return;

	IInventory *pInventory = pActor->GetInventory();

	if(!pInventory)
		return;

	// give & select the refgun
	EntityId itemId = pInventory->GetItemByClass(CItem::sRefWeaponClass);

	if(0 == itemId)
	{
		// if actor doesn't have it, only give it in editor
		if(!gEnv->IsEditor())
			return;

		itemId = pItemSystem->GiveItem(pActor, CItem::sRefWeaponClass->GetName(), false, true, true);
	}

	pItemSystem->SetActorItem(pActor, itemId, true);

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

示例3: CanPlayerSpawnThisRound

bool CGameRulesSpawningBase::CanPlayerSpawnThisRound(const EntityId playerId) const
{
	bool allowed=true;

	IActor *pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(playerId);

	if (pActor->IsPlayer())
	{
		CGameRules *pGameRules = g_pGame->GetGameRules();
		IGameRulesPlayerStatsModule *playerStats = pGameRules ? pGameRules->GetPlayerStatsModule() : NULL;

		if (playerStats)
		{
			const SGameRulesPlayerStat *stats = playerStats->GetPlayerStats(playerId);
			if (stats)
			{
				if (stats->flags & SGameRulesPlayerStat::PLYSTATFL_CANTSPAWNTHISROUND)
				{	
					allowed=false;
				}
			}
		}
	}

	CryLog("CGameRulesSpawningBase::CanPlayerSpawnThisRound() player=%s allowed=%d", pActor->GetEntity()->GetName(), allowed);
	return allowed;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:27,代码来源:GameRulesSpawningBase.cpp

示例4: StartUse

//------------------------------------------------------------------------
void CVehicleMountedWeapon::StartUse(EntityId userId)
{
	IVehicle *pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(m_vehicleId);
	if (!IsRippingOff() && pVehicle)
	{ 
		m_pOwnerSeat = pVehicle->GetWeaponParentSeat(GetEntityId());
		m_pSeatUser = pVehicle->GetSeatForPassenger(userId);

		IActor* pOwner = GetOwnerActor();
		if (pOwner && !pOwner->IsPlayer())
		{
			SHUDEvent hudEvent(eHUDEvent_AddEntity);
			hudEvent.AddData((int)pVehicle->GetEntityId());
			CHUDEventDispatcher::CallEvent(hudEvent);
		}

		ClearItemFlags(eIF_InformClientsAboutUse);
 	}

	CHeavyMountedWeapon::StartUse(userId);

	CActor* pActor = GetOwnerActor();
	if (pActor && pActor->IsPlayer())
	{
		static_cast<CPlayer*>(pActor)->RefreshVisibilityState();
	}
}
开发者ID:amrhead,项目名称:eaascode,代码行数:28,代码来源:VehicleMountedWeapon.cpp

示例5: SetAmmoCount

//------------------------------------------------------------------------
void CVehicleWeapon::SetAmmoCount(IEntityClass* pAmmoType, int count)
{ 
  IActor* pOwner = GetOwnerActor();
  
  if (pOwner && !pOwner->IsPlayer() && count < m_ammo[pAmmoType])
    return;
  
  CWeapon::SetAmmoCount(pAmmoType, count);    
}
开发者ID:kitnet,项目名称:crynegine,代码行数:10,代码来源:VehicleWeapon.cpp

示例6: SetAmmoCount

//------------------------------------------------------------------------
void CVehicleMountedWeapon::SetAmmoCount(IEntityClass* pAmmoType, int count)
{ 
 	IActor* pOwner = GetOwnerActor();
 
	if (pOwner && !pOwner->IsPlayer() && count < SWeaponAmmoUtils::GetAmmoCount(m_ammo, pAmmoType))
 		return;

	CHeavyMountedWeapon::SetAmmoCount(pAmmoType, count);    
}
开发者ID:amrhead,项目名称:eaascode,代码行数:10,代码来源:VehicleMountedWeapon.cpp

示例7: OnStep

	EContextEstablishTaskResult OnStep( SContextEstablishState& state )
	{
		bool allowPlayers = (m_what & eFS_Players) != 0;
		bool allowGameRules = (m_what & eFS_GameRules) != 0;
		bool allowOthers = (m_what & eFS_Others) != 0;
		EntityId gameRulesId = 0;
		if (IEntity * pGameRules = CCryAction::GetCryAction()->GetIGameRulesSystem()->GetCurrentGameRulesEntity())
			gameRulesId = pGameRules->GetId();

		// we are in the editor, and that means that there have been entities spawned already
		// that are not bound to the network context... so lets bind them!
		IEntityItPtr pIt = gEnv->pEntitySystem->GetEntityIterator();
		while (IEntity * pEntity = pIt->Next())
		{
			bool isOther = true;

			bool isPlayer = false;
			IActor* pActor = CCryAction::GetCryAction()->GetIActorSystem()->GetActor(pEntity->GetId());
			if (pActor && pActor->IsPlayer())
			{
				isPlayer = true;
				isOther = false;
			}
			if (isPlayer && !allowPlayers)
				continue;

			bool isGameRules = false;
			if (pEntity->GetId() == gameRulesId)
			{
				isGameRules = true;
				isOther = false;
			}
			if (isGameRules && !allowGameRules)
				continue;

			if (isOther && !allowOthers)
				continue;

			CGameObject * pGO = (CGameObject *) pEntity->GetProxy( ENTITY_PROXY_USER );
			if (pGO)
			{
				if (pGO->IsBoundToNetwork())
					pGO->BindToNetwork(eBTNM_Force); // force rebinding
			}

			SEntitySpawnParams fakeParams;
			fakeParams.id = pEntity->GetId();
			fakeParams.nFlags = pEntity->GetFlags();
			fakeParams.pClass = pEntity->GetClass();
			fakeParams.qRotation = pEntity->GetRotation();
			fakeParams.sName = pEntity->GetName();
			fakeParams.vPosition = pEntity->GetPos();
			fakeParams.vScale = pEntity->GetScale();
			CCryAction::GetCryAction()->GetGameContext()->OnSpawn( pEntity, fakeParams );
		}
		return eCETR_Ok;
	}
开发者ID:aronarts,项目名称:FireNET,代码行数:57,代码来源:CET_EntitySystem.cpp

示例8: IsPlayer

int CScriptBind_Game::IsPlayer(IFunctionHandler *pH, ScriptHandle entityId)
{
	EntityId eId = (EntityId)entityId.n;
	if(eId == LOCAL_PLAYER_ENTITY_ID)
		return pH->EndFunction(true);

	IActor *pActor = gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(eId);
	return pH->EndFunction(pActor && pActor->IsPlayer());
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:9,代码来源:ScriptBind_Game.cpp

示例9: CorrectRipperEntityPosition

//------------------------------------------------------------------------
void CVehicleMountedWeapon::CorrectRipperEntityPosition(float timeStep)
{
	IVehicle *pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(m_vehicleId);
	if(pVehicle)
	{
		const IEntity* pVehicleEnt = pVehicle->GetEntity();

		Vec3 posDiff(ZERO);
		IActor* pOwner = GetOwnerActor();
		if (pOwner && pOwner->IsPlayer())
		{
			CPlayer* pPlayer	 = static_cast<CPlayer*>(pOwner); 
			const Matrix34& wMat = pVehicleEnt->GetWorldTM(); 
			Vec3 vehiclePos		 = wMat.GetTranslation();
			Vec3 currWSpaceRipUserOffset = wMat.TransformPoint(m_localRipUserOffset);

			posDiff = currWSpaceRipUserOffset - m_previousWSpaceOffsetPosition;

			// Don't want to overwrite anyone else changes with an absolute 'set'
			pOwner->GetEntity()->SetPos(pOwner->GetEntity()->GetWorldPos() + posDiff); 

			m_previousWSpaceOffsetPosition = currWSpaceRipUserOffset;

			//Update view limit direction based on change in vehicle rotation
			if(pPlayer->IsClient())
			{
				SViewLimitParams &viewLimits = pPlayer->GetActorParams().viewLimits;
				if(viewLimits.GetViewLimitRangeH()) //Don't do this unless we are currently horizontally constrained
				{
					Quat vehicleRotation(wMat);
					Quat rotationChange = vehicleRotation * m_previousVehicleRotation.GetInverted();

					Vec3 viewLimitDir = rotationChange * viewLimits.GetViewLimitDir();
					viewLimitDir.z = 0.f;
					viewLimitDir.Normalize();

					viewLimits.SetViewLimit(viewLimitDir, 0.01f, 0.01f, 0.f, 0.f, SViewLimitParams::eVLS_Item);

					m_previousVehicleRotation = vehicleRotation;
				}

				//Reset the pitch/roll view angles over time
				Quat viewDirFinal = pPlayer->GetViewQuatFinal();
				Ang3 viewAngles(viewDirFinal);
				float xAdjustment = (float)__fsel(viewAngles.x, max(-viewAngles.x, -0.5f * timeStep), min(-viewAngles.x, 0.5f * timeStep));
				float yAdjustment = (float)__fsel(viewAngles.y, max(-viewAngles.y, -0.5f * timeStep), min(-viewAngles.y, 0.5f * timeStep));

				if(xAdjustment || yAdjustment)
				{
					pPlayer->AddViewAngles(Ang3(xAdjustment, yAdjustment, 0.f));
				}
			}
		}
	}
}
开发者ID:amrhead,项目名称:eaascode,代码行数:56,代码来源:VehicleMountedWeapon.cpp

示例10:

//------------------------------------------------------------------------
CAVMine::~CAVMine()
{
	if(gEnv->bMultiplayer && gEnv->bServer)
	{
		IActor* pOwner = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(m_ownerId);
		if(pOwner && pOwner->IsPlayer())
		{
			((CPlayer*)pOwner)->RecordExplosiveDestroyed(GetEntityId(), 1);
		}
	}
}
开发者ID:AiYong,项目名称:CryGame,代码行数:12,代码来源:AVMine.cpp

示例11: Init

//---------------------------------
void CFOVEffect::Init()
{
	IActor *client = gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(m_ownerID);
	if (client && client->IsPlayer())
	{
		CPlayer *player = (CPlayer *)client;
		SActorParams *params = player->GetActorParams();
		m_startFOV = params->viewFoVScale;
		m_currentFOV = m_startFOV;
	}
}
开发者ID:MrHankey,项目名称:destructionderby,代码行数:12,代码来源:ScreenEffects.cpp

示例12: Update

//---------------------------------
void CFOVEffect::Update(float point)
{
	m_currentFOV = (point * (m_goalFOV - m_startFOV)) + m_startFOV;
	IActor *client = gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(m_ownerID);
	if (client && client->IsPlayer())
	{
		CPlayer *player = (CPlayer *)client;
		SActorParams *params = player->GetActorParams();
		params->viewFoVScale = m_currentFOV;
	}
}
开发者ID:MrHankey,项目名称:destructionderby,代码行数:12,代码来源:ScreenEffects.cpp

示例13: PlayerIsInAir

	bool PlayerIsInAir()
	{
		bool InAir = false;
		IActor* pClientActor = gEnv->pGame->GetIGameFramework()->GetClientActor();
		if (pClientActor && pClientActor->IsPlayer())
		{
			CPlayer* pPlayer = static_cast<CPlayer*>(pClientActor);
			InAir = pPlayer->IsInAir() || pPlayer->IsInFreeFallDeath();
		}
		return InAir;
	}
开发者ID:PiratesAhoy,项目名称:HeartsOfOak-Core,代码行数:11,代码来源:GameNodes.cpp

示例14: SetInventoryAmmoCount

//------------------------------------------------------------------------
void CVehicleWeapon::SetInventoryAmmoCount(IEntityClass* pAmmoType, int count)
{
  IActor* pOwner = GetOwnerActor();

  if (pOwner && !pOwner->IsPlayer() && m_pVehicle)
  {
    if (count < m_pVehicle->GetAmmoCount(pAmmoType))
      return;
  }

  CWeapon::SetInventoryAmmoCount(pAmmoType, count);
}
开发者ID:kitnet,项目名称:crynegine,代码行数:13,代码来源:VehicleWeapon.cpp

示例15: SetInventoryAmmoCount

//------------------------------------------------------------------------
void CVehicleMountedWeapon::SetInventoryAmmoCount(IEntityClass* pAmmoType, int count)
{
 	IActor* pOwner = GetOwnerActor();
	IVehicle *pVehicle = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(m_vehicleId);

	if (pVehicle && pOwner && !pOwner->IsPlayer())
	{
		if (count < pVehicle->GetAmmoCount(pAmmoType))
 			return;
 	}

	CHeavyMountedWeapon::SetInventoryAmmoCount(pAmmoType, count);
}
开发者ID:amrhead,项目名称:eaascode,代码行数:14,代码来源:VehicleMountedWeapon.cpp


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