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


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

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


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

示例1: Save

	void Save( SActivationInfo *pActInfo )
	{
		m_name = GetPortString( pActInfo, EIP_Name );
		PathUtil::RemoveExtension(m_name);

		if(gEnv->IsEditor())
		{
			m_state	= ES_Idle;
			pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, false);

			IActor* pClientActor = g_pGame->GetIGameFramework()->GetClientActor();
			if (pClientActor && !pClientActor->IsDead())
				ActivateOutput(pActInfo, EOP_SaveOrLoadDone, true);
		}
		else
		{
			if(IGame *pGame = gEnv->pGame)
			{
				pGame->GetIGameFramework()->RegisterListener(this, "CFlowSaveGameNode", FRAMEWORKLISTENERPRIORITY_DEFAULT);
			}
			pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, true);
			m_state	= ES_WaitForSaveDone;
		}

		if(gEnv->pGame)
		{
			gEnv->pGame->GetIGameFramework()->SaveGame(gEnv->pGame->CreateSaveGameName().c_str(), true, false, eSGR_FlowGraph, false, m_name.c_str());
		}
	}
开发者ID:PiratesAhoy,项目名称:HeartsOfOak-Core,代码行数:29,代码来源:GameNodes.cpp

示例2: CanDrawCrosshair

bool CBitmapUi::CanDrawCrosshair() const
{
	assert( m_pGameFramework != NULL );

	if ( ! g_pGameCVars->g_show_crosshair )
	{
		return false;
	}

	IActor* pPlayer = m_pGameFramework->GetClientActor();
	if ( pPlayer == NULL )
	{
		return false;
	}

	bool isPlayerDead = pPlayer->IsDead();
	if ( isPlayerDead )
	{
		return false;
	}

	bool thirdPersonMode = pPlayer->IsThirdPerson();
	bool crosshairEnabledInThirdPerson = ( g_pGameCVars->g_show_crosshair_tp != 0 );
	if ( thirdPersonMode && ! crosshairEnabledInThirdPerson )
	{
		return false;
	}

	IItem* pItem = pPlayer->GetCurrentItem();
	if ( pItem == NULL )
	{
		return false;
	}

	IWeapon* pWeapon = pItem->GetIWeapon();
	if ( pWeapon == NULL )
	{
		return false;
	}

	bool carryingMeleeWeapon = pWeapon->CanMeleeAttack();
	if ( carryingMeleeWeapon )
	{
		return false;
	}

	bool isWeaponZoomed = pWeapon->IsZoomed();
	bool usingWeaponSightForAiming = ( ! thirdPersonMode && isWeaponZoomed );		
	if ( usingWeaponSightForAiming )
	{
		return false;
	}

	return true;
}
开发者ID:AiYong,项目名称:CryGame,代码行数:55,代码来源:BitmapUi.cpp

示例3: Update

void CProceduralContextRagdoll::Update( float timePassedSeconds )
{
	if( m_bInBlendOut )
	{
		m_blendOutTimeCurrent -= timePassedSeconds;
		const float blendOutFactor = max( m_blendOutTime > 0.0f ? m_blendOutTimeCurrent/m_blendOutTime : 0.0f, 0.0f );

		if( IEntity* pEntity = gEnv->pEntitySystem->GetEntity( m_targetEntityId ) )
		{
			if(IPhysicalEntity* pent = pEntity->GetPhysics())
			{
				pe_status_nparts parts;
				int partCount = pent->GetStatus(&parts);
				for (int i=0; i<partCount; ++i)
				{
					pe_params_part pp;
					pe_params_joint pj;
					pp.ipart = i;
					pent->GetParams(&pp);
					pj.op[1] = pp.partid;
					pj.ks = Vec3(max(m_stiffness * blendOutFactor, 1.0f));
					pent->SetParams(&pj);
				}
			}
		}

		if( blendOutFactor == 0.0f )
		{
			IActor* piActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor( m_targetEntityId );
			if( piActor )
			{
				ForceRagdollFinish( piActor, false );
			}
			Reset();

			m_bInRagdoll = piActor ? piActor->IsDead() : true;
		}
	}
	else if( m_bInRagdoll && !m_bEntityAlive && !m_bFromProcClip )
	{
		IActor* piActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor( m_targetEntityId );
		if( piActor )
		{
			ForceRagdollFinish( piActor, true );
		}
	}
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:47,代码来源:ProceduralContextRagdoll.cpp

示例4: hudEvent

void CC4Projectile::Update(SEntityUpdateContext &ctx, int updateSlot)
{
	if(gEnv->bMultiplayer)
	{
		IActor* pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(m_ownerId);
		if(!pActor || pActor->IsDead())
		{
			if(gEnv->bServer)
			{
				Destroy();
			}
			else
			{
				GetEntity()->Hide(true);
			}

			RemoveLight();
			if(m_isShowingUIIcon)
			{
				SHUDEvent hudEvent(eHUDEvent_RemoveC4Icon);
				hudEvent.AddData((int)GetEntityId());
				CHUDEventDispatcher::CallEvent(hudEvent);
				m_isShowingUIIcon = false;
			}
		}
	}

	if(m_pLightSource)
	{
		UpdateLight(ctx.fFrameTime, false);
	}

	if(m_disarmTimer > 0.f)
	{
		m_disarmTimer -= ctx.fFrameTime;
		if(m_disarmTimer <= 0.f)
		{
			m_disarmTimer = 0.f;
			Arm(true);
		}
	}

	BaseClass::Update(ctx, updateSlot);
}
开发者ID:Xydrel,项目名称:Infected,代码行数:44,代码来源:C4Projectile.cpp

示例5: Update

void CPlayerPlugin_CurrentlyTargetting::Update(float dt)
{
	m_currentTargetTime += dt;	//updated locally for all players (so doesn't have to be synced)

	assert (IsEntered());
	if (m_ownerPlayer->IsClient())
	{
		EntityId newTargetId = !m_ownerPlayer->IsDead() ? m_ownerPlayer->GetGameObject()->GetWorldQuery()->GetLookAtEntityId() : 0;

		if (newTargetId)
		{
			IActor * targettedActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(newTargetId);
			if (targettedActor == NULL || targettedActor->IsDead())
			{
				newTargetId = 0;
			}
		}

		if (m_currentTarget != newTargetId)
		{
			m_currentTarget = newTargetId;










			CCCPOINT_IF(m_currentTarget, PlayerState_LocalPlayerNowTargettingSomebody);
			CCCPOINT_IF(!m_currentTarget, PlayerState_LocalPlayerNowTargettingNobody);

			m_currentTargetTime = 0.0f;
			CHANGED_NETWORK_STATE(m_ownerPlayer, CPlayer::ASPECT_CURRENTLYTARGETTING_CLIENT);
		}
	}

#if PLAYER_PLUGIN_DEBUGGING
	IEntity* pEntity = gEnv->pEntitySystem->GetEntity(m_currentTarget);
	PlayerPluginWatch ("Target e%05d (%s %s) - %.2f", m_currentTarget, pEntity ? pEntity->GetName() : "NULL", pEntity ? pEntity->GetClass()->GetName() : "entity", m_currentTargetTime);
#endif
}
开发者ID:aronarts,项目名称:FireNET,代码行数:44,代码来源:PlayerPlugin_CurrentlyTargetting.cpp

示例6: UpdatePerformanceTestInGame

void CAutoTester::UpdatePerformanceTestInGame()
{
	IActor* pPlayer = gEnv->pGame->GetIGameFramework()->GetClientActor();
	if (pPlayer)
	{
		float timeSeconds=gEnv->pTimer->GetFrameStartTime().GetSeconds();

		if (pPlayer->IsDead())
		{
			CryLogAlways("CAutoTester::UpdatePerformanceTestInGame() detected that our player is dead - requesting revive");

// 			IGameRulesSpawningModule *pSpawningModule = g_pGame->GetGameRules()->GetSpawningModule();
// 			if (pSpawningModule)
// 			{
// 				CryLog("CAutoTester::UpdatePerformanceTestInGame() Requesting revive");
// 				pSpawningModule->ClRequestRevive(pPlayer->GetEntityId());
// 			}
			GameWarning("   TODO: ClRequestRevive ot implemented!");
		}
		else
		{
			if (!m_stateData.testPerformance.m_bConfigExecuted)
			{
				if (timeSeconds > m_stateData.testPerformance.m_delayToStart)
				{
					CryLogAlways("CAutoTester::UpdatePerformanceTestInGame() executing configfile=%s", m_stateData.testPerformance.m_configFile);
					gEnv->pConsole->ExecuteString(string().Format("exec %s", m_stateData.testPerformance.m_configFile));
					m_stateData.testPerformance.m_bConfigExecuted = true;
				}
			}
		}
	
		//CryWatch("time=%f; timeOut=%f", timeSeconds, m_stateData.testPerformance.m_timeOut);

		if (timeSeconds > m_stateData.testPerformance.m_timeOut)
		{
			CryLogAlways("CAutoTester::UpdatePerformanceTestInGame() finished running test - disconnecting to generate telemetry");
			gEnv->pConsole->ExecuteString("disconnect");
			m_stateData.testPerformance.m_subState = CAutoTester::k_testPerformance_substate_waiting_to_submit_telemetry;
			m_stateData.testPerformance.m_timeOut = timeSeconds + 10.0f;
		}
	}
}
开发者ID:Adi0927,项目名称:alecmercer-origins,代码行数:43,代码来源:AutoTester.cpp

示例7: ProcessEvent

	virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Activate:
			if (IsPortActive(pActInfo, 0)) 
			{
				IActor* pActor = GetAIActor(pActInfo);
				if(pActor)
				{
					if (!pActor->IsDead())
					{
						pActor->SetHealth( GetPortFloat(pActInfo, 1) );
						ActivateOutput(pActInfo, 0, pActor->GetHealth()); // use pActor->GetHealth (might have been clamped to maxhealth]
					}
				}
				else
				{
					GameWarning("CFlowActorSetHealth - No Entity or Entity not an actor!");
				}
			}
		}
	}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:23,代码来源:FlowGameNodes.cpp

示例8: SpawnScreenExplosionEffect

//--------------------------------------------------------------------------------------------------
// Name: SpawnScreenExplosionEffect
// Desc: Spawns screen explosion effect
//--------------------------------------------------------------------------------------------------
void CExplosionGameEffect::SpawnScreenExplosionEffect(const SExplosionContainer &explosionContainer)
{
	// Disclaimer: this code was originally from GameRulesClientServer::ProcessClientExplosionScreenFX()

	const ExplosionInfo& explosionInfo = explosionContainer.m_explosionInfo;

	if(explosionInfo.pressure < 1.0f)
		return;

	IActor *pClientActor = g_pGame->GetIGameFramework()->GetClientActor();
	if(pClientActor != NULL && !pClientActor->IsDead())
	{
		CPlayer* pPlayer = static_cast<CPlayer*>(pClientActor);
		bool hasFlashBangEffect = explosionInfo.blindAmount > 0.0f;

		// Flashbang friends and self?...
		if(hasFlashBangEffect)
		{
			bool flashBangSelf = true;
			bool flashBangFriends = false;
#ifndef _RELEASE
			flashBangSelf = g_pGameCVars->g_flashBangSelf != 0;
			flashBangFriends = g_pGameCVars->g_flashBangFriends != 0;
#endif
			bool ownFlashBang = pPlayer->GetEntityId() == explosionInfo.shooterId;
			if((!flashBangSelf && ownFlashBang) || // FlashBang self?
				((g_pGame->GetGameRules()->GetFriendlyFireRatio()<=0.0f) && (!flashBangFriends) && (!ownFlashBang) && pPlayer->IsFriendlyEntity(explosionInfo.shooterId))) // FlashBang friends?
			{
				return;
			}
		}

		// Distance
		float dist = (pClientActor->GetEntity()->GetWorldPos() - explosionInfo.pos).len();

		// Is the explosion in Player's FOV (let's suppose the FOV a bit higher, like 80)
		SMovementState state;
		if(IMovementController *pMV = pClientActor->GetMovementController())
		{
			pMV->GetMovementState(state);
		}

		Vec3 eyeToExplosion = explosionInfo.pos - state.eyePosition;
		Vec3 eyeDir = pClientActor->GetLinkedVehicle() ? pPlayer->GetVehicleViewDir() : state.eyeDirection;
		eyeToExplosion.Normalize();
		float eyeDirectionDP = eyeDir.Dot(eyeToExplosion);
		bool inFOV = (eyeDirectionDP > 0.68f);

		// All explosions have radial blur (default 30m radius)
		const float maxBlurDistance = (explosionInfo.maxblurdistance >0.0f) ? explosionInfo.maxblurdistance : 30.0f;
		if((maxBlurDistance > 0.0f) && (g_pGameCVars->g_radialBlur > 0.0f) && (explosionInfo.radius > 0.5f))
		{		
			if (inFOV && (dist < maxBlurDistance))
			{
				const int intersectionObjTypes = ent_static | ent_terrain;
				const unsigned int intersectionFlags = rwi_stop_at_pierceable|rwi_colltype_any;

				m_deferredScreenEffects.RequestRayCast(CDeferredExplosionEffect::eDET_RadialBlur, 
														explosionInfo.pos, -eyeToExplosion, dist, maxBlurDistance, intersectionObjTypes, intersectionFlags, NULL, 0);
			}
		}

		// Flashbang effect 
		if(hasFlashBangEffect && ((dist < (explosionInfo.radius*g_pGameCVars->g_flashBangNotInFOVRadiusFraction)) 
			|| (inFOV && (dist < explosionInfo.radius))))
		{
			ray_hit hit;
			const int intersectionObjTypes = ent_static | ent_terrain;
			const unsigned int intersectionFlags = rwi_stop_at_pierceable|rwi_colltype_any;
			const int intersectionMaxHits = 1;

			int collision = gEnv->pPhysicalWorld->RayWorldIntersection(	explosionInfo.pos, 
																																	-eyeToExplosion*dist, 
																																	intersectionObjTypes, 
																																	intersectionFlags, 
																																	&hit, 
																																	intersectionMaxHits);

			// If there was no obstacle between flashbang grenade and player
			if(!collision)
			{
				bool enabled = true;
				if(enabled)
				{
					CCCPOINT (FlashBang_Explode_BlindLocalPlayer);
					float timeScale = max(0.0f, 1 - (dist/explosionInfo.radius));
					float lookingAt = max(g_pGameCVars->g_flashBangMinFOVMultiplier, (eyeDirectionDP + 1)*0.5f);

					float time = explosionInfo.flashbangScale * timeScale *lookingAt;	// time is determined by distance to explosion		

					CRY_ASSERT_MESSAGE(pClientActor->IsPlayer(),"Effect shouldn't be spawned if not a player");

					SPlayerStats* pStats = static_cast<SPlayerStats*>(pPlayer->GetActorStats());

					NET_BATTLECHATTER(BC_Blinded, pPlayer);

//.........这里部分代码省略.........
开发者ID:amrhead,项目名称:eaascode,代码行数:101,代码来源:ExplosionGameEffect.cpp

示例9: StickToEntity

bool CStickyProjectile::StickToEntity( const SStickParams& stickParams, IEntity* pTargetEntity )
{
	IEntity* pProjectileEntity = stickParams.m_pProjectile->GetEntity();
	ICharacterInstance* pCharInstance = pTargetEntity->GetCharacter(0);
	if( pCharInstance)	
	{
		IActor* pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pTargetEntity->GetId());
		if (!pActor || (stickParams.m_bStickToFriendlies || !pActor->IsFriendlyEntity(stickParams.m_ownerId)) && (gEnv->bMultiplayer || !pActor->IsDead()))
		{
			m_stuckJoint = GetJointIdFromPartId(*pTargetEntity, stickParams.m_targetPartId);
			m_stuckNormal = stickParams.m_stickNormal;
			m_stuckPartId = stickParams.m_targetPartId;

			ICharacterModelSkeleton* pICharacterModelSkeleton = pCharInstance->GetICharacterModel()->GetICharacterModelSkeleton();
			ISkeletonPose* pSkeleton = pCharInstance->GetISkeletonPose();
			const char* boneName = pICharacterModelSkeleton->GetJointNameByID(m_stuckJoint);
			const QuatT jointWorld = QuatT(pTargetEntity->GetWorldTM()) * pSkeleton->GetAbsJointByID(m_stuckJoint);
			QuatT loc;
			CalculateLocationForStick( *pProjectileEntity, stickParams.m_stickPosition, stickParams.m_stickNormal, loc );
			pProjectileEntity->SetWorldTM(Matrix34(loc));

			// Get the local pos and rot.
			loc = jointWorld.GetInverted() * loc;
			m_stuckPos = loc.t;
			m_stuckRot = loc.q;

			// Attach.
			if(AttachToCharacter( stickParams.m_pProjectile, *pTargetEntity, *pCharInstance, boneName))
			{
				m_flags |= eSF_IsStuck;
				m_flags |= pActor ? pActor->IsPlayer() ? eSF_StuckToPlayer : eSF_StuckToAI : 0;
				SetParentId(pTargetEntity->GetId());
				m_childId = pProjectileEntity->GetId();
				return true;
			}
		}
	}
	else
	{
		m_stuckNormal = stickParams.m_stickNormal;
		m_stuckPartId = stickParams.m_targetPartId;

		QuatT loc;
		CalculateLocationForStick( *pProjectileEntity, stickParams.m_stickPosition, stickParams.m_stickNormal, loc );

		AttachTo(stickParams.m_pProjectile, pTargetEntity);

		pProjectileEntity->SetWorldTM(Matrix34(loc));

		// Set as Stuck.
		SetParentId(pTargetEntity->GetId());
		m_childId = pProjectileEntity->GetId();
		m_flags |= eSF_IsStuck;

		//Store position and rotation relative to parent entity
		m_stuckPos = pProjectileEntity->GetPos();
		m_stuckRot = pProjectileEntity->GetRotation();
		return true;
	}

	return false;
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:62,代码来源:StickyProjectile.cpp

示例10: Update


//.........这里部分代码省略.........
	}
#endif

	if (gEnv->IsClient())
	{
		if (m_state == EGRS_PreGame)
		{
			if( !gEnv->IsDedicated() )
			{
				if (m_isStarting)
				{
					const float timeTillStartInSeconds = m_pGameRules->GetRemainingStartTimer();
					SHUDEventWrapper::UpdateGameStartCountdown( ePreGameCountdown_MatchStarting, timeTillStartInSeconds );
				}
				else
				{
					SHUDEventWrapper::UpdateGameStartCountdown( ePreGameCountdown_WaitingForPlayers, 0.0f );
				}
			}
		}
		else if (m_state == EGRS_InGame && !gEnv->IsDedicated() )
		{
			if (m_introMessageShown == false)	// Show only once
			{
				CGameRules *pGameRules = g_pGame->GetGameRules();
				if (pGameRules && pGameRules->HasGameActuallyStarted())
				{
					if (EntityId localPlayerId = g_pGame->GetIGameFramework()->GetClientActorId())
					{
						int teamId = g_pGame->GetGameRules()->GetTeam(localPlayerId);
						bool bTeamGame = (pGameRules->GetTeamCount() > 1);

						IActor *pActor = g_pGame->GetIGameFramework()->GetClientActor();
						if (pActor->GetSpectatorMode()==CActor::eASM_None && !pActor->IsDead() && (!bTeamGame || teamId!=0))
						{
							if (IGameRulesPlayerStatsModule *statsModule = pGameRules->GetPlayerStatsModule())
							{
								const SGameRulesPlayerStat *stats = statsModule->GetPlayerStats(localPlayerId);
								if (stats->deaths <= 0) // Not died ever
								{
									if (m_startMatchString.empty() == false)
									{
										const char* gamemodeName = g_pGame->GetGameRules()->GetEntity()->GetClass()->GetName();

										CryFixedStringT<32> strSignalName;
										strSignalName.Format("StartGame%s", gamemodeName);
										TAudioSignalID signalId = g_pGame->GetGameAudio()->GetSignalID(strSignalName);

										CryFixedStringT<64> localisedStartString = CHUDUtils::LocalizeString( m_startMatchString.c_str() );

										if (bTeamGame)
										{
											CryFixedStringT<16> strTeamName;
											strTeamName.Format("@ui_hud_team_%d", teamId);
											
											SHUDEventWrapper::TeamMessage(strTeamName.c_str(), teamId, SHUDEventWrapper::SMsgAudio(signalId), false, true);
											SHUDEventWrapper::SimpleBannerMessage(localisedStartString.c_str(), SHUDEventWrapper::kMsgAudioNULL);
										}
										else
										{
											SHUDEventWrapper::RoundMessageNotify(localisedStartString.c_str(), SHUDEventWrapper::SMsgAudio(signalId));
										}
									}
								}
							}
开发者ID:aronarts,项目名称:FireNET,代码行数:66,代码来源:GameRulesStandardState.cpp


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