本文整理汇总了C++中GetOwnerActor函数的典型用法代码示例。如果您正苦于以下问题:C++ GetOwnerActor函数的具体用法?C++ GetOwnerActor怎么用?C++ GetOwnerActor使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetOwnerActor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetOwnerActor
//------------------------------------------------------------------------
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();
}
}
示例2: SetDualSlaveAccessory
//------------------------------------------------------------------------
void CItem::SetDualSlaveAccessory(bool noNetwork)
{
if(!gEnv->bMultiplayer || (GetOwnerActor() && GetOwnerActor()->IsClient()))
{
CItem *pSlave = static_cast<CItem *>(GetDualWieldSlave());
if (!pSlave)
return;
//Detach current accessories of the slave
TAccessoryMap temp = pSlave->m_accessories;
for (TAccessoryMap::const_iterator it=temp.begin(); it!=temp.end(); ++it)
{
if(m_accessories.find(it->first)==m_accessories.end())
pSlave->SwitchAccessory(it->first.c_str()); //Only remove if not in the master
}
//Attach on the slave same accessories as "parent"
for (TAccessoryMap::const_iterator it=m_accessories.begin(); it!=m_accessories.end(); ++it)
{
if(pSlave->m_accessories.find(it->first)==pSlave->m_accessories.end())
{
if(noNetwork)
pSlave->AttachAccessory(it->first.c_str(), true, true, true);
else
pSlave->SwitchAccessory(it->first.c_str()); //Only add if not already attached
}
}
}
}
示例3: ResetState
void CBinocular::OnDropped(EntityId actorId)
{
ResetState();
if(GetOwnerActor() == NULL)
return;
GetOwnerActor()->SelectLastItem(true, true);
}
示例4: CRY_ASSERT
//------------------------------------------------------
void CWeapon::SetInputFlag(uint8 actionFlag)
{
CRY_ASSERT(GetOwnerActor() && ( GetOwnerActor()->IsClient() || !GetOwnerActor()->IsPlayer() ) );
if (!s_lockActionRequests)
{
s_requestedActions |= actionFlag;
}
}
示例5: DrawSlot
//========================================
void CRocketLauncher::PickUp(EntityId pickerId, bool sound, bool select, bool keepHistory, const char *setup)
{
CWeapon::PickUp(pickerId,sound,select,keepHistory, setup);
if(m_auxSlotUsed)
{
DrawSlot(eIGS_ThirdPersonAux,false);
m_auxSlotUsed = false;
}
if(GetOwnerActor() && !GetOwnerActor()->IsPlayer())
m_stats.first_selection = false;
}
示例6: IMPLEMENT_RMI
//------------------------------------------------------------------------
IMPLEMENT_RMI(CItem, SvRequestAttachAccessory)
{
if (IInventory *pInventory=GetActorInventory(GetOwnerActor()))
{
char accessoryName[129] = {0};
bool result = g_pGame->GetIGameFramework()->GetNetworkSafeClassName(accessoryName, 128, params.accessoryClassId);
#if !defined(_RELEASE)
if(!result)
{
char errorMsg[256];
sprintf(errorMsg, "CItem::SvRequestAttachAccessory failed to find network safe class name for id %d", params.accessoryClassId);
CRY_ASSERT_MESSAGE(result, errorMsg);
}
#endif
if (accessoryName[0] != '\0' && pInventory->GetCountOfClass(accessoryName)>0)
{
DoSwitchAccessory(accessoryName);
GetGameObject()->InvokeRMI(ClAttachAccessory(), params, eRMI_ToAllClients|eRMI_NoLocalCalls);
return true;
}
}
return true; // set this to false later
}
示例7: GetOwnerActor
//---------------------------------------------------------------------------
void CVehicleWeapon::CheckForFriendlyPlayers(float frameTime)
{
CActor *pOwner = GetOwnerActor();
if(pOwner && pOwner->IsPlayer() && gEnv->bMultiplayer)
{
m_timeToUpdate-=frameTime;
if(m_timeToUpdate>0.0f)
return;
m_timeToUpdate = 0.15f;
if(IMovementController *pMC = pOwner->GetMovementController())
{
SMovementState info;
pMC->GetMovementState(info);
ray_hit rayhit;
IPhysicalEntity *pSkipEnts[10];
int nSkip = CSingle::GetSkipEntities(this, pSkipEnts, 10);
int intersect = gEnv->pPhysicalWorld->RayWorldIntersection(info.weaponPosition, info.aimDirection * 150.0f, ent_all,
rwi_stop_at_pierceable|rwi_colltype_any, &rayhit, 1, pSkipEnts, nSkip);
IEntity *pLookAtEntity = NULL;
if(intersect && rayhit.pCollider)
pLookAtEntity = m_pEntitySystem->GetEntityFromPhysics(rayhit.pCollider);
bool bFriendly = false;
}
}
}
示例8: PerformRipOff
void CHeavyMountedWeapon::SetRippingOff(bool ripOff)
{
if(ripOff && !m_rippingOff && !m_rippedOff)
{
PerformRipOff(GetOwnerActor());
}
}
示例9: GetEntity
void CHeavyMountedWeapon::ProcessEvent(SEntityEvent& event)
{
if ((event.event == ENTITY_EVENT_XFORM) && IsMounted() && GetOwnerId())
{
const float Z_EPSILON = 0.01f;
const Ang3& worldAngles = GetEntity()->GetWorldAngles();
float xAngle = worldAngles.x;
float zAngle = worldAngles.z;
bool xAnglesAreEquivalent = (fabs(xAngle-m_lastXAngle)<Z_EPSILON);
bool zAnglesAreEquivalent = (fabs(zAngle-m_lastZAngle)<Z_EPSILON);
if (!xAnglesAreEquivalent || !zAnglesAreEquivalent)
{
if (m_rotatingSoundID==INVALID_SOUNDID)
m_rotatingSoundID = PlayRotationSound();
m_RotationSoundTimeOut = 0.15f;
RequireUpdate( eIUS_General );
m_lastXAngle = xAngle;
m_lastZAngle = zAngle;
}
int flags = (int)event.nParam[0];
if ((flags & ENTITY_XFORM_FROM_PARENT) && !(flags & ENTITY_XFORM_USER))
{
if (CActor* pOwnerActor = GetOwnerActor())
{
pOwnerActor->UpdateMountedGunController(true);
}
}
}
BaseClass::ProcessEvent(event);
}
示例10: SwitchToRippedOffFireMode
void CHeavyMountedWeapon::SetUnMountedConfiguration()
{
SwitchToRippedOffFireMode();
IFireMode * pMountedFireMode = GetFireMode(0);
assert(pMountedFireMode);
pMountedFireMode->Enable(false);
ExitZoom(true);
//Second zoom mode is supposed to be unmounted
if(GetZoomMode(1))
{
EnableZoomMode(1, true);
SetCurrentZoomMode(1);
}
//Just in case, it was not clear properly
CActor* pOwner = GetOwnerActor();
if ((pOwner != NULL) && pOwner->IsClient())
{
float defaultFov = 55.0f;
gEnv->pRenderer->EF_Query(EFQ_SetDrawNearFov,defaultFov);
}
}
示例11: GetOwnerActor
//---------------------------------------------------------------------------------
bool CWeapon::OnActionFiremode(EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
CActor* pOwner = GetOwnerActor();
CPlayer* pPlayer = pOwner && pOwner->IsPlayer() ? static_cast<CPlayer*>(pOwner) : 0;
if (pPlayer && (pPlayer->IsCinematicFlagActive(SPlayerStats::eCinematicFlag_LowerWeapon) || pPlayer->IsCinematicFlagActive(SPlayerStats::eCinematicFlag_LowerWeaponMP)) )
return true;
bool incompatibleZommMode = (m_secondaryZmId != 0 && (IsZoomed() || IsZoomingInOrOut()));
if (AreAnyItemFlagsSet(eIF_BlockActions) || incompatibleZommMode)
{
return true;
}
if (activationMode == eAAM_OnPress)
{
IFireMode* pNewFiremode = GetFireMode(GetNextFireMode(GetCurrentFireMode()));
if (pNewFiremode == m_fm)
{
if(pPlayer && pPlayer->CanSwitchItems())
{
pPlayer->SwitchToWeaponWithAccessoryFireMode();
}
}
else if (!IsReloading())
{
StartChangeFireMode();
}
}
return true;
}
示例12: CheckSprint
bool CWeapon::CheckSprint()
{
CPlayer *pPlayer = static_cast<CPlayer*>(GetOwnerActor());
if(!pPlayer || pPlayer->IsSliding())
return false;
SPlayerStats *pStats = static_cast<SPlayerStats*>(pPlayer->GetActorStats());
assert(pStats);
if(pPlayer->IsSprinting())
{
pStats->bIgnoreSprinting = true;
float delayScale = pPlayer->GetModifiableValues().GetValue(kPMV_WeaponFireFromSprintTimeScale);
m_delayedFireActionTimeOut = GetParams().sprintToFireDelay * delayScale;
return true;
}
else if (m_delayedFireActionTimeOut > 0.f)
{
return true;
}
return false;
}
示例13: GetOwnerActor
//------------------------------------------------------------------------
void CItem::UpdateFPPosition(float frameTime)
{
CActor* pActor = GetOwnerActor();
if (!pActor)
return;
SPlayerStats *pStats = static_cast<SPlayerStats *>(pActor->GetActorStats());
if (!pStats)
return;
Matrix34 tm = Matrix33::CreateRotationXYZ(pStats->FPWeaponAngles);
Vec3 offset(0.0f,0.0f,0.0f);
float right(g_pGameCVars->i_offset_right);
float front(g_pGameCVars->i_offset_front);
float up(g_pGameCVars->i_offset_up);
if (front!=0.0f || up!=0.0f || right!=0.0f)
{
offset += tm.GetColumn(0).GetNormalized() * right;
offset += tm.GetColumn(1).GetNormalized() * front;
offset += tm.GetColumn(2).GetNormalized() * up;
}
tm.SetTranslation(pStats->FPWeaponPos + offset);
GetEntity()->SetWorldTM(tm);
//CryLogAlways("weaponpos: %.3f,%.3f,%.3f // weaponrot: %.3f,%.3f,%.3f", tm.GetTranslation().x,tm.GetTranslation().y,tm.GetTranslation().z, pStats->FPWeaponAngles.x, pStats->FPWeaponAngles.y, pStats->FPWeaponAngles.z);
}
示例14: PreActionAttack
//--------------------------------------------------------------------
bool CWeapon::PreActionAttack(bool startFire)
{
// Melee while pressing SHIFT for SP
CPlayer *pPlayer = static_cast<CPlayer*>(GetOwnerActor());
if(!pPlayer)
return false;
/*
//if(gEnv->bMultiplayer)
{
if(startFire && pPlayer->IsSprinting())
{
//Stop sprinting, start firing
SPlayerStats *pStats = static_cast<SPlayerStats*>(pPlayer->GetActorStats());
if(pStats)
{
pStats->bSprinting = false;
pStats->bIgnoreSprinting = true;
}
}
else if(!startFire)
{
//Stop firing, continue sprinting
SPlayerStats *pStats = static_cast<SPlayerStats*>(pPlayer->GetActorStats());
if(pStats)
pStats->bIgnoreSprinting = false;
}
}
return false;
*/
if(startFire && pPlayer->IsSprinting()) return true;
else return false;
}
示例15: CollisionFeeback
//---------------------------------------------------------------
void CFists::CollisionFeeback(Vec3 &pos, int eFAS)
{
CPlayer *pPlayer = static_cast<CPlayer*>(GetOwnerActor());
if(pPlayer)
{
switch(eFAS)
{
case eFAS_RUNNING:
pPlayer->PlaySound(CPlayer::ESound_Hit_Wall,true,true,"speed",0.4f);
break;
case eFAS_JUMPING:
pPlayer->PlaySound(CPlayer::ESound_Hit_Wall,true,true,"speed",0.8f);
break;
default:
break;
}
}
//FX feedback
IParticleEffect *pEffect = gEnv->pParticleManager->FindEffect("collisions.footsteps.dirt");
if (pEffect)
{
Matrix34 tm = IParticleEffect::ParticleLoc(pos);
pEffect->Spawn(true,tm);
}
}