本文整理汇总了C++中IActor::IsClient方法的典型用法代码示例。如果您正苦于以下问题:C++ IActor::IsClient方法的具体用法?C++ IActor::IsClient怎么用?C++ IActor::IsClient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IActor
的用法示例。
在下文中一共展示了IActor::IsClient方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateEntityInVTOL
void CVTOLVehicleManager::UpdateEntityInVTOL( SVTOLInfo& vtolInfo, EntityId entityId )
{
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Note.. would be nice if we could programatically spawn trigger boxes matching vehicle AABB dimensions //
// And attach to VTOLS.. then just listen for OnEnter and OnExit events rather than horrible polling :( //
// Spawning programatically avoids Design having to manually set then up (depends if *can* attach though) //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
IEntity* pEntity = gEnv->pEntitySystem->GetEntity(entityId);
if(!pEntity)
return;
AABB playerAABB;
pEntity->GetWorldBounds(playerAABB);
const bool inVtol = TestIsInVTOL(vtolInfo, playerAABB);
IActor* pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(entityId);
if(CActor* pCActor = static_cast<CActor*>(pActor))
{
pCActor->ImmuneToForbiddenZone(inVtol);
}
// Perform AABB OBB intersect test between player and vehicle
if(inVtol)
{
vtolInfo.playersInside.push_back(entityId);
if(pActor && pActor->IsClient())
{
//In case we get in the VTOL after having already left the battlefield - turn off the warning UI
CHUDEventDispatcher::CallEvent(SHUDEvent(eHUDEvent_ReturningToBattleArea));
}
}
}
示例2: UpdateView
//------------------------------------------------------------------------
void CVehicleViewFirstPerson::UpdateView(SViewParams &viewParams, EntityId playerId)
{
// JB: Attaching vehicles to trackview causes the view position to be out of date
// by the time we reach Update view, introducing view lag. Need to re-update
m_viewPosition = GetWorldPosGoal();
if (!m_passengerId)
return;
viewParams.nearplane = 0.02f;
viewParams.fov = m_fov;
if (EntityId weaponId = m_pVehicle->GetCurrentWeaponId(m_passengerId))
{
if (IItem* pItem = CCryAction::GetCryAction()->GetIItemSystem()->GetItem(weaponId))
{
if (pItem->FilterView(viewParams))
return;
}
}
viewParams.position = m_viewPosition;
viewParams.rotation = GetVehicleRotGoal() * Quat::CreateRotationXYZ(m_rotation);
// set view direction on actor
IActor* pActor = CCryAction::GetCryAction()->GetIActorSystem()->GetActor(playerId);
if(pActor && pActor->IsClient())
{
pActor->SetViewInVehicle(viewParams.rotation);
}
// recoil
viewParams.rotation *= Quat::CreateRotationXYZ(m_viewAngleOffset);
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:35,代码来源:VehicleViewFirstPerson.cpp
示例3: UpdateView
//------------------------------------------------------------------------
void CVehicleViewSteer::UpdateView(SViewParams &viewParams, EntityId playerId)
{
static bool doUpdate = true;
if (!doUpdate) return;
if (m_position.IsValid())
{
viewParams.position = m_position;
}
else
{
CRY_ASSERT_MESSAGE(0, "camera position invalid");
}
Vec3 dir = (m_lookAt - m_position).GetNormalizedSafe();
if (dir.IsValid() && dir.GetLengthSquared() > 0.01f)
{
viewParams.rotation = Quat::CreateRotationVDir(dir);
}
else
{
CRY_ASSERT_MESSAGE(0, "camera rotation invalid");
}
// set view direction on actor
IActor* pActor = m_pSeat->GetPassengerActor(true);
if (pActor && pActor->IsClient())
{
pActor->SetViewInVehicle(viewParams.rotation);
}
}
示例4: Update
//---------------------------------
void CPostProcessEffect::Update(float point)
{
IActor *client = gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(m_ownerID);
if (client && client->IsClient())
{
m_currentVal = (point * (m_goalVal - m_startVal)) + m_startVal;
gEnv->p3DEngine->SetPostEffectParam(m_paramName, m_currentVal);
}
}
示例5: Init
//---------------------------------
void CPostProcessEffect::Init()
{
IActor *client = gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(m_ownerID);
if (client && client->IsClient())
{
gEnv->p3DEngine->GetPostEffectParam(m_paramName, m_currentVal);
m_startVal = m_currentVal;
}
}
示例6: GetDesiredAimPosition
Vec3 CVehicleSeatActionOrientateBoneToView::GetDesiredAimPosition() const
{
IActor* pActor = m_pVehicle->GetDriver();
if(pActor && pActor->IsClient())
{
const CCamera& camera = gEnv->pSystem->GetViewCamera();
return camera.GetPosition() + (camera.GetViewdir() * 100.f);
}
return m_pVehicle->GetEntity()->GetWorldTM().GetColumn1();
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:11,代码来源:VehicleSeatActionOrientateBoneToView.cpp
示例7: MaintainPartRotationWorldSpace
void CVehicleSeatActionRotateTurret::MaintainPartRotationWorldSpace(EVehicleTurretRotationType eType)
{
CVehiclePartBase* pPart = m_rotations[eType].m_pPart;
IVehiclePart* pParent = pPart->GetParent();
IActor* pActor = m_pSeat->GetPassengerActor();
bool remote = m_pSeat->GetCurrentTransition() == IVehicleSeat::eVT_RemoteUsage;
bool worldSpace = m_rotations[eType].m_worldSpace && VehicleCVars().v_independentMountedGuns != 0;
if (worldSpace && pParent && pActor && pActor->IsClient() && !remote)
{
// we want to keep the old worldspace rotation
// therefore we're updating the local transform from it
// NB: there is no need to clamp here, its done later
Matrix34 localTM = pParent->GetWorldTM().GetInverted() * Matrix34(m_rotations[eType].m_prevWorldQuat);
localTM.OrthonormalizeFast(); // precision issue
const Matrix34 &baseTM = pPart->GetLocalBaseTM();
if (!Matrix34::IsEquivalent(baseTM,localTM))
{
Ang3 anglesCurr(baseTM);
Ang3 angles(localTM);
if (eType == eVTRT_Pitch)
{
angles.y = anglesCurr.y;
angles.z = anglesCurr.z;
}
else if (eType == eVTRT_Yaw)
{
angles.x = anglesCurr.x;
angles.y = anglesCurr.y;
}
localTM.SetRotationXYZ(angles);
localTM.SetTranslation(baseTM.GetTranslation());
pPart->SetLocalBaseTM(localTM);
m_pSeat->ChangedNetworkState(CVehicle::ASPECT_PART_MATRIX);
}
#if ENABLE_VEHICLE_DEBUG
if (VehicleCVars().v_debugdraw == eVDB_Parts)
{
float color[] = {1,1,1,1};
Ang3 a(localTM), aBase(baseTM);
gEnv->pRenderer->Draw2dLabel(200,200,1.4f,color,false,"localAng: %.1f (real: %.1f)", RAD2DEG(a.z), RAD2DEG(aBase.z));
}
#endif
}
}
示例8: NetAllowUpdate
//------------------------------------------------------------------------
bool CWeapon::NetAllowUpdate(bool requireActor)
{
if (!gEnv->bServer)
{
IActor *pActor = GetOwnerActor();
if(!pActor && requireActor)
{
return false;
}
if (!pActor || !pActor->IsClient())
{
return true;
}
}
return false;
}
示例9: PickUp
void CJaw::PickUp(EntityId pickerId, bool sound, bool select, bool keepHistory, const char* setup)
{
for (TAmmoVector::iterator it = m_bonusammo.begin(); it != m_bonusammo.end(); ++it)
{
SWeaponAmmo& currentBonusAmmo = *it;
currentBonusAmmo.count = 0;
}
IItemSystem* pItemSystem = gEnv->pGame->GetIGameFramework()->GetIItemSystem();
IActor* pPicketActor = gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pickerId);
IInventory* pInventory = pPicketActor->GetInventory();
bool giveExtraTube = GiveExtraTubeToInventory(pPicketActor, pItemSystem);
if (pPicketActor->IsClient())
SetAmmoCount(m_fm->GetAmmoType(), 1);
BaseClass::PickUp(pickerId,sound,select,keepHistory, setup);
if (giveExtraTube)
{
int numJaws = m_weaponsharedparams->ammoParams.extraItems;
while(numJaws-- > 0)
{
pItemSystem->GiveItem(pPicketActor, GetEntity()->GetClass()->GetName(), false, false, false);
}
m_extraTubesAdded = true;
}
if(m_auxSlotUsed)
{
DrawSlot(eIGS_ThirdPersonAux,false);
m_auxSlotUsed = false;
}
if(GetOwnerActor() && !GetOwnerActor()->IsPlayer())
m_stats.first_selection = false;
}
示例10: ProcessActionsLift
//------------------------------------------------------------------------
void CVehicleMovementHelicopter::ProcessActionsLift(float deltaTime)
{
Ang3 angles = m_pEntity->GetWorldAngles();
// const float& currentPitch = angles.x;
const float ¤tRoll = angles.y;
float boost = Boosting() ? m_boostMult : 1.0f;
float workingUpDirZ = max(0.90f, min(1.0f, m_workingUpDir.z));
float pitchRatio = (workingUpDirZ - 0.95f) / 0.05f;
float liftAction = 0.0f;
if(pitchRatio > -0.0001f)
liftAction = m_liftAction * sinf(pitchRatio * gf_PI * 0.5f);
float fwdAction = 0.0f;
if(pitchRatio < -0.0001f)
fwdAction = m_liftAction * cosf(pitchRatio * gf_PI * 0.5f);
if(m_liftAction < 0.0f && pitchRatio < 0.0f)
{
liftAction = m_liftAction * (-max(-1.0f, pitchRatio) * 0.5f);
fwdAction = 0.0f;
}
m_noHoveringTimer = 0.0f;
float gravity;
pe_simulation_params paramsSim;
if(GetPhysics()->GetParams(¶msSim))
gravity = abs(paramsSim.gravity.z);
else
gravity = 9.8f;
// hovering force
m_control.impulse += Vec3(m_workingUpDir.x, m_workingUpDir.y, min(1.0f, m_workingUpDir.z)) * gravity * (boost);
m_control.impulse += m_workingUpDir * m_enginePower * gravity * liftAction * boost;
// forward force
m_control.impulse += Vec3(m_workingUpDir.x, m_workingUpDir.y, 0.0f) * gravity * m_enginePower * fwdAction;
if(abs(m_desiredRoll) > 0.0001)
{
float side = 1.0f;
if(currentRoll < 0.0f)
side = -1.0f;
else if(currentRoll > 0.0f)
side = 1.0f;
else
side = 0.0f;
m_control.impulse += m_currentLeftDir * m_enginePower * (m_liftAction + (m_desiredRoll * side)) * boost;
}
// force damping
float horizDamp = m_velDamp;
float vertDamp = 1.0f;
if(Boosting())
horizDamp *= 0.25f;
float turbulenceMult = 1.0f - min(m_turbulenceMultMax, m_turbulence);
m_control.impulse.x -= m_PhysDyn.v.x * horizDamp;
m_control.impulse.y -= m_PhysDyn.v.y * horizDamp;
m_control.impulse.z -= m_PhysDyn.v.z * vertDamp;
#if ENABLE_VEHICLE_DEBUG
IActor *pActor = m_pActorSystem->GetActor(m_actorId);
int profile = g_pGameCVars->v_profileMovement;
if((profile == 1 && pActor && pActor->IsClient()) || profile == 2)
{
IRenderer *pRenderer = gEnv->pRenderer;
float color[4] = {1,1,1,1};
Ang3 localAngles = m_pEntity->GetWorldAngles();
pRenderer->Draw2dLabel(5.0f, 350.0f, 1.5f, color, false, "pitchRatio: %f, liftAction: %f, fwdAction: %f", pitchRatio, liftAction, fwdAction);
}
#endif
}
示例11: Update
//------------------------------------------------------------------------
void CVehicleMovementHelicopter::Update(const float deltaTime)
{
FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);
CVehicleMovementBase::Update(deltaTime);
CryAutoCriticalSection lk(m_lock);
if(m_isTouchingGround)
{
m_timeOnTheGround += deltaTime;
m_isTouchingGround = false;
}
else
{
m_timeOnTheGround = 0.0f;
}
// ai specific sound matter
if(m_soundMasterVolume != m_vehicleVolume)
{
float vol = m_soundMasterVolume;
if(m_vehicleVolume == 0)
CVehicleMovementBase::SetSoundMasterVolume(m_vehicleVolume);
else if(vol < m_vehicleVolume)
{
vol +=deltaTime;
if(vol > m_vehicleVolume)
vol = m_vehicleVolume;
CVehicleMovementBase::SetSoundMasterVolume(vol);
}
else if(vol > m_vehicleVolume)
{
vol -=deltaTime;
if(vol < m_vehicleVolume)
vol = m_vehicleVolume;
CVehicleMovementBase::SetSoundMasterVolume(vol);
}
}
// update animation
if(m_isEngineGoingOff)
{
if(m_enginePower > 0.0f)
{
UpdateEngine(deltaTime);
}
else
{
m_enginePower = 0.0f;
}
}
SetAnimationSpeed(eVMA_Engine, (m_enginePower / m_enginePowerMax));
#if ENABLE_VEHICLE_DEBUG
IActor *pActor = m_pActorSystem->GetActor(m_actorId);
int profile = g_pGameCVars->v_profileMovement;
if((profile == 1 && pActor && pActor->IsClient()) || profile == 2)
{
IRenderer *pRenderer = gEnv->pRenderer;
float color[4] = {1,1,1,1};
Ang3 localAngles = m_pEntity->GetWorldAngles();
m_mass = m_statusDyn.mass;
Vec3 &velocity = m_statusDyn.v;
Vec3 &angVelocity = m_statusDyn.w;
pRenderer->Draw2dLabel(5.0f, 0.0f, 2.0f, color, false, "Helicopter movement");
Vec3 i;
i = m_control.impulse.GetNormalizedSafe();
pRenderer->Draw2dLabel(5.0f, 85.0f, 1.5f, color, false, "impulse: %f, %f, %f (%f, %f, %f)", m_control.impulse.x, m_control.impulse.y, m_control.impulse.z, i.x, i.y, i.z);
pRenderer->Draw2dLabel(5.0f, 100.0f, 1.5f, color, false, "angImpulse: %f, %f, %f", m_control.angImpulse.x, m_control.angImpulse.y, m_control.angImpulse.z);
i = velocity.GetNormalizedSafe();
pRenderer->Draw2dLabel(5.0f, 115.0f, 1.5f, color, false, "velocity: %f, %f, %f (%f) (%f, %f, %f)", velocity.x, velocity.y, velocity.z, velocity.GetLength(), i.x, i.y, i.z);
pRenderer->Draw2dLabel(5.0f, 130.0f, 1.5f, color, false, "angular velocity: %f, %f, %f", RAD2DEG(angVelocity.x), RAD2DEG(angVelocity.y), RAD2DEG(angVelocity.z));
pRenderer->Draw2dLabel(5.0f, 160.0f, 1.5f, color, false, "angles: %f, %f, %f (%f, %f, %f)", RAD2DEG(localAngles.x), localAngles.y, localAngles.z, RAD2DEG(localAngles.x), RAD2DEG(localAngles.y), RAD2DEG(localAngles.z));
pRenderer->Draw2dLabel(5.0f, 175.0f, 1.5f, color, false, "m_rpmScale: %f, damage: %f, damageActual: %f, turbulence: %f", m_rpmScale, m_damage, m_damageActual, m_turbulence);
pRenderer->Draw2dLabel(5.0f, 190.0f, 1.5f, color, false, "m_turnAction: %f, actionYaw: %f, targetRotation: %f, %f, %f", m_turnAction, m_actionYaw, RAD2DEG(m_rotateTarget.x), RAD2DEG(m_rotateTarget.y), RAD2DEG(m_rotateTarget.z));
pRenderer->Draw2dLabel(5.0f, 220.0f, 1.5f, color, false, "lift: %f, engineForce: %f, hoveringPower: %f, desiredHeight: %f, boost: %d, fwdAction: %f", m_liftAction, m_engineForce, m_hoveringPower, m_desiredHeight, Boosting(), m_forwardAction);
pRenderer->Draw2dLabel(5.0f, 235.0f, 1.5f, color, false, "pitchAction: %f, rollAction: %f", m_actionPitch, m_actionRoll);
pRenderer->Draw2dLabel(5.0f, 250.0f, 1.5f, color, false, "desiredPitch: %f, desiredRoll: %f", m_desiredPitch, m_desiredRoll);
Vec3 direction = m_pEntity->GetWorldTM().GetColumn(1);
pRenderer->Draw2dLabel(5.0f, 270.0f, 1.5f, color, false, "fwd direction: %.2f, %.2f, %.2f", direction.x, direction.y, direction.z);
pRenderer->Draw2dLabel(5.0f, 285.0f, 1.5f, color, false, "workingUpDir: %.2f, %.2f, %.2f", m_workingUpDir.x, m_workingUpDir.y, m_workingUpDir.z);
pRenderer->Draw2dLabel(5.0f, 300.0f, 1.5f, color, false, "accel: %f", m_playerAcceleration);
}
//.........这里部分代码省略.........
示例12: Update
//------------------------------------------------------------------------
void CVehicleMovementVTOL::Update(const float deltaTime)
{
FUNCTION_PROFILER( GetISystem(), PROFILE_GAME );
CVehicleMovementHelicopter::Update(deltaTime);
CryAutoCriticalSection lk(m_lock);
if (m_pWingsAnimation)
{
m_pWingsAnimation->SetTime(m_wingsAnimTime);
}
IActorSystem* pActorSystem = g_pGame->GetIGameFramework()->GetIActorSystem();
assert(pActorSystem);
IActor* pActor = pActorSystem->GetActor(m_actorId);
if (pActor && pActor->IsClient())
{
float turbulence = m_turbulence;
if (m_pAltitudeLimitVar)
{
float altitudeLimit = m_pAltitudeLimitVar->GetFVal();
float currentHeight = m_pEntity->GetWorldPos().z;
if (!iszero(altitudeLimit))
{
float altitudeLowerOffset;
if (m_pAltitudeLimitLowerOffsetVar)
{
float r = 1.0f - min(1.0f, max(0.0f, m_pAltitudeLimitLowerOffsetVar->GetFVal()));
altitudeLowerOffset = r * altitudeLimit;
if (currentHeight >= altitudeLowerOffset)
{
if (currentHeight > altitudeLowerOffset)
{
float zone = altitudeLimit - altitudeLowerOffset;
turbulence += (currentHeight - altitudeLowerOffset) / (zone);
}
}
}
}
}
if (turbulence > 0.0f)
{
static_cast<CActor*>(pActor)->CameraShake(0.50f * turbulence, 0.0f, 0.05f, 0.04f, Vec3(0.0f, 0.0f, 0.0f), 10, "VTOL_Update_Turbulence");
}
float enginePowerRatio = m_enginePower / m_enginePowerMax;
if (enginePowerRatio > 0.0f)
{
float rpmScaleDesired = 0.2f;
rpmScaleDesired += abs(m_forwardAction) * 0.8f;
rpmScaleDesired += abs(m_strafeAction) * 0.4f;
rpmScaleDesired += abs(m_turnAction) * 0.25f;
rpmScaleDesired = min(1.0f, rpmScaleDesired);
Interpolate(m_rpmScale, rpmScaleDesired, 1.0f, deltaTime);
}
float turnParamGoal = min(1.0f, abs(m_turnAction)) * 0.6f;
turnParamGoal *= (min(1.0f, max(0.0f, m_speedRatio)) + 1.0f) * 0.50f;
turnParamGoal += turnParamGoal * m_boost * 0.25f;
Interpolate(m_soundParamTurn, turnParamGoal, 0.5f, deltaTime);
SetSoundParam(eSID_Run, "turn", m_soundParamTurn);
float damage = GetSoundDamage();
if (damage > 0.1f)
{
//if (ISound* pSound = GetOrPlaySound(eSID_Damage, 5.f, m_enginePos))
//SetSoundParam(pSound, "damage", damage);
}
}
}
示例13: ClSetReloadState
void CWeapon::ClSetReloadState(int state)
{
assert(!gEnv->bServer);
if(m_fm)
{
IActor *pActor = GetOwnerActor();
bool ownerIsLocal = pActor && pActor->IsClient();
switch(state)
{
case eNRS_NoReload:
{
if(IsReloading())
m_fm->NetEndReload();
m_reloadState = state;
break;
}
case eNRS_StartReload:
{
if(!IsReloading(false))
{
m_fm->Reload(m_zm ? m_zm->GetCurrentStep() : 0);
}
m_reloadState = eNRS_StartReload;
break;
}
case eNRS_EndReload:
{
if(ownerIsLocal)
{
m_fm->NetEndReload();
}
m_reloadState = eNRS_NoReload;
break;
}
case eNRS_CancelReload:
{
if(!ownerIsLocal)
{
m_fm->CancelReload();
}
else
{
m_fm->NetEndReload();
}
m_reloadState = eNRS_NoReload;
break;
}
default:
{
break;
}
}
}
}