本文整理汇总了C++中IActor::GetEntity方法的典型用法代码示例。如果您正苦于以下问题:C++ IActor::GetEntity方法的具体用法?C++ IActor::GetEntity怎么用?C++ IActor::GetEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IActor
的用法示例。
在下文中一共展示了IActor::GetEntity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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));
}
}
}
}
}
示例2: Update
//------------------------------------------------------------------------
void CVehicleActionDeployRope::Update(const float deltaTime)
{
if (!m_ropeUpperId && !m_ropeLowerId && !m_actorId)
return;
IActorSystem* pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
assert(pActorSystem);
IActor* pActor = pActorSystem->GetActor(m_actorId);
if (!pActor)
return;
Vec3 worldPos = pActor->GetEntity()->GetWorldTM().GetTranslation();
if (IRopeRenderNode* pRopeUpper = GetRopeRenderNode(m_ropeUpperId))
{
Vec3 points[2];
points[0] = m_pRopeHelper->GetWorldTM().GetTranslation();
points[1] = worldPos;
pRopeUpper->SetPoints(points, 2);
float lenghtLeft = max(0.0f, g_ropeLenght - (points[0].z - points[1].z));
if (IRopeRenderNode* pRopeLower = GetRopeRenderNode(m_ropeLowerId))
{
Vec3 points[2];
points[0] = worldPos;
points[1] = Vec3(worldPos.x, worldPos.y, worldPos.z - lenghtLeft);
pRopeLower->SetPoints(points, 2);
}
}
}
示例3: 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;
}
}
}
示例4: Execute
void CMFXForceFeedbackEffect::Execute(SMFXRunTimeEffectParams& params)
{
FUNCTION_PROFILER(gEnv->pSystem, PROFILE_ACTION);
if (params.playflags & MFX_PLAY_FORCEFEEDBACK)
{
float distanceToPlayerSqr = FLT_MAX;
IActor *pClientActor = gEnv->pGame->GetIGameFramework()->GetClientActor();
if (pClientActor)
{
distanceToPlayerSqr = (pClientActor->GetEntity()->GetWorldPos() - params.pos).GetLengthSquared();
}
const float testDistanceSqr = clamp_tpl(distanceToPlayerSqr, m_forceFeedbackParams.intensityFallOffMinDistanceSqr, m_forceFeedbackParams.intensityFallOffMaxDistanceSqr);
const float minMaxDiffSqr = m_forceFeedbackParams.intensityFallOffMaxDistanceSqr - m_forceFeedbackParams.intensityFallOffMinDistanceSqr;
float effectIntensity = (float)__fsel(-minMaxDiffSqr, 0.0f, 1.0f - (testDistanceSqr - m_forceFeedbackParams.intensityFallOffMinDistanceSqr) / (minMaxDiffSqr + FLT_EPSILON));
effectIntensity *= effectIntensity;
if (effectIntensity > 0.01f)
{
IForceFeedbackSystem* pForceFeedback = CCryAction::GetCryAction()->GetIForceFeedbackSystem();
assert(pForceFeedback);
ForceFeedbackFxId fxId = pForceFeedback->GetEffectIdByName(m_forceFeedbackParams.forceFeedbackEventName.c_str());
pForceFeedback->PlayForceFeedbackEffect(fxId, SForceFeedbackRuntimeParams(effectIntensity, 0.0f));
}
}
}
示例5: GotoTagPoint
void CDevMode::GotoTagPoint( int i )
{
std::vector<STagFileEntry> tags = LoadTagFile();
if (tags.size() > size_t(i))
{
STagFileEntry ent = tags[i];
IActor * pActor = CCryAction::GetCryAction()->GetClientActor();
if (!pActor) return;
IEntity * pEntity = pActor->GetEntity();
Quat rot;
Vec3 pos = ent.pos;
// pos loaded is a camera position, we must convert it into the player position.
if (IMovementController * pMC = pActor->GetMovementController())
{
SMovementState ms;
pMC->GetMovementState(ms);
pos -= (ms.eyePosition-ms.pos);
}
rot.SetRotationXYZ( ent.ang );
Vec3 scale = pEntity->GetScale();
pEntity->SetPosRotScale( pos, rot, scale );
pActor->SetViewRotation( rot );
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:27,代码来源:DevMode.cpp
示例6: 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;
}
示例7: 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;
}
示例8: 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
示例9: OutputDistance
void CTornado::OutputDistance()
{
IActor *pClient = g_pGame->GetIGameFramework()->GetClientActor();
if (!pClient)
return;
Vec3 deltaToClient(pClient->GetEntity()->GetWorldPos() - GetEntity()->GetWorldPos());
deltaToClient.z = 0;
EntityScripts::CallScriptFunction(GetEntity(), GetEntity()->GetScriptTable(), "ScriptEvent", "outputDistance", deltaToClient.len(), 0);
}
示例10:
//------------------------------------------------------------------------
IEntity * CEditorGame::GetPlayer()
{
IGameFramework * pGameFramework = m_pGame->GetIGameFramework();
if(!m_pGame)
return 0;
IActor * pActor = pGameFramework->GetClientActor();
return pActor? pActor->GetEntity() : NULL;
}
示例11:
//------------------------------------------------------------------------
IMPLEMENT_RMI(CGameRules, SvHostMigrationRequestSetup)
{
uint16 channelId = m_pGameFramework->GetGameChannelId(pNetChannel);
IActor *pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActorByChannelId(channelId);
CRY_ASSERT(pActor);
CryLog("SvHostMigrationRequestSetup, unpacking setup for player '%s', channel=%i", pActor->GetEntity()->GetName(), channelId);
// if (pActor->IsDead() && (params.m_timeToAutoRevive > 0.f))
// {
// IGameRulesSpawningModule *pSpawningModule = GetSpawningModule();
// pSpawningModule->HostMigrationInsertIntoReviveQueue(pActor->GetEntityId(), params.m_timeToAutoRevive * 1000.f);
// }
return true;
}
示例12: SetPlayerPosAng
//------------------------------------------------------------------------
void CEditorGame::SetPlayerPosAng(Vec3 pos,Vec3 viewDir)
{
IActor * pClActor = m_pGame->GetIGameFramework()->GetClientActor();
if (pClActor /*&& m_bGameMode*/)
{
// pos coming from editor is a camera position, we must convert it into the player position by subtructing eye height.
IEntity *myPlayer = pClActor->GetEntity();
if (myPlayer)
{
pe_player_dimensions dim;
dim.heightEye = 0;
if (myPlayer->GetPhysics())
{
myPlayer->GetPhysics()->GetParams( &dim );
pos.z = pos.z - dim.heightEye;
}
}
pClActor->GetEntity()->SetPosRotScale( pos,Quat::CreateRotationVDir(viewDir),Vec3(1,1,1),ENTITY_XFORM_EDITOR|ENTITY_XFORM_POS|ENTITY_XFORM_ROT|ENTITY_XFORM_SCL);
}
}
示例13: ProcessEvent
virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
{
switch (event)
{
case eFE_Activate:
{
IActor* pActor = GetAIActor(pActInfo);
if (!pActor)
break;
IEntity* pEnt = pActor->GetEntity();
if (!pEnt)
break;
HSCRIPTFUNCTION func = 0;
int ret = 0;
IScriptTable* pTable = pEnt->GetScriptTable();
if (!pTable)
break;
if (IsPortActive(pActInfo, 1) && pTable->GetValue("GrabObject", func))
{
IEntity* pObj = gEnv->pEntitySystem->GetEntity( GetPortEntityId(pActInfo, 0) );
if (pObj)
{
IScriptTable* pObjTable = pObj->GetScriptTable();
Script::CallReturn(gEnv->pScriptSystem, func, pTable, pObjTable, ret);
}
ActivateOutput(pActInfo, 0, ret);
}
else if (IsPortActive(pActInfo, 2) && pTable->GetValue("DropObject", func))
{
bool bThrow = GetPortBool(pActInfo, 3);
Script::CallReturn(gEnv->pScriptSystem, func, pTable, bThrow, ret);
ActivateOutput(pActInfo, 0, ret);
}
if (pTable->GetValue("GetGrabbedObject", func))
{
ScriptHandle sH(0);
Script::CallReturn(gEnv->pScriptSystem, func, pTable, sH);
ActivateOutput(pActInfo, 1, EntityId(sH.n));
}
if(func)
gEnv->pScriptSystem->ReleaseFunc(func);
break;
}
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:51,代码来源:FlowGameNodes.cpp
示例14: SetPlayerMaxVelGround
void CFlowConvoyNode::SetPlayerMaxVelGround(float vel)
{
IActor *pPlayerActor = gEnv->pGame->GetIGameFramework()->GetClientActor();
if(pPlayerActor)
{
IPhysicalEntity *pPhysicalEntity=pPlayerActor->GetEntity()->GetPhysics();
if(pPhysicalEntity)
{
pe_player_dynamics ppd;
ppd.maxVelGround=vel;
pPhysicalEntity->SetParams(&ppd);
}
}
}
示例15:
int CFlowConvoyNode::GetCoachIndexPlayerIsOn2()
{
IActor *pPlayerActor = gEnv->pGame->GetIGameFramework()->GetClientActor();
Vec3 playerPos=pPlayerActor->GetEntity()->GetWorldPos();
for (size_t i = 0; i < m_coaches.size(); ++i)
{
AABB bbox;
m_coaches[i].m_pEntity->GetLocalBounds(bbox);
Vec3 localpos=m_coaches[i].m_pEntity->GetWorldTM().GetInverted().TransformPoint(playerPos);
if(bbox.min.x<=localpos.x && bbox.min.y<=localpos.y && bbox.max.x>=localpos.x && bbox.max.y>=localpos.y)
return i;
}
return -1;
}