本文整理汇总了C++中IActorSystem::GetActor方法的典型用法代码示例。如果您正苦于以下问题:C++ IActorSystem::GetActor方法的具体用法?C++ IActorSystem::GetActor怎么用?C++ IActorSystem::GetActor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IActorSystem
的用法示例。
在下文中一共展示了IActorSystem::GetActor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShakeClient
//------------------------------------------------------------------------
void CVehicleDamageBehaviorCameraShake::ShakeClient(float angle, float shift, float duration, float frequency)
{
IActorSystem *pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
assert(pActorSystem);
EntityId clientId = g_pGame->GetIGameFramework()->GetClientActorId();
for (TVehicleSeatId seatId = InvalidVehicleSeatId + 1;
seatId != m_pVehicle->GetLastSeatId(); seatId++)
{
if (IVehicleSeat *pSeat = m_pVehicle->GetSeatById(seatId))
{
EntityId passengerId = pSeat->GetPassenger();
if (passengerId == clientId)
{
CActor *pActor = static_cast<CActor *>(pActorSystem->GetActor(passengerId));
if(pActor)
{
pActor->CameraShake(angle, shift, duration, frequency, Vec3(0.0f, 0.0f, 0.0f), 5, "VehicleDamageBehaviorCameraShake");
}
}
}
}
}
示例2: 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;
}
}
}
示例3: 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);
}
}
}
示例4: GetEntityType
EEntityType GetEntityType(EntityId id)
{
int type = eET_Unknown;
IEntitySystem *pEntitySystem = gEnv->pEntitySystem;
if (pEntitySystem)
{
IEntity *pEntity = pEntitySystem->GetEntity(id);
if (pEntity)
{
type = eET_Valid;
IEntityClass *pClass = pEntity->GetClass();
if (pClass)
{
const char* className = pClass->GetName();
// Check AI
if (pEntity->GetAI())
{
type |= eET_AI;
}
// Check actor
IActorSystem *pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
if (pActorSystem)
{
IActor *pActor = pActorSystem->GetActor(id);
if (pActor)
{
type |= eET_Actor;
}
}
// Check vehicle
IVehicleSystem *pVehicleSystem = gEnv->pGame->GetIGameFramework()->GetIVehicleSystem();
if (pVehicleSystem)
{
if (pVehicleSystem->IsVehicleClass(className))
{
type |= eET_Vehicle;
}
}
// Check item
IItemSystem *pItemSystem = gEnv->pGame->GetIGameFramework()->GetIItemSystem();
if (pItemSystem)
{
if (pItemSystem->IsItemClass(className))
{
type |= eET_Item;
}
}
}
}
}
return (EEntityType)type;
}
示例5: RefreshAnimTarget
void CAnimatedCharacter::RefreshAnimTarget()
{
if (m_pMannequinAGState)
{
IActorSystem* pActorSystem = CCryAction::GetCryAction()->GetIActorSystem();
assert(pActorSystem != NULL);
IActor* pActor = pActorSystem->GetActor(GetEntity()->GetId());
IMovementController* pMovementController = pActor->GetMovementController();
m_pAnimTarget = pMovementController->GetExactPositioningTarget();
}
}
示例6: StopUsing
//------------------------------------------------------------------------
void CVehicleSeatActionMovement::StopUsing()
{
IActorSystem* pActorSystem = CCryAction::GetCryAction()->GetIActorSystem();
CRY_ASSERT(pActorSystem);
IVehicleMovement* pMovement = m_pVehicle->GetMovement();
if (!pMovement)
return;
CRY_ASSERT(m_pSeat);
// default to continuing for a bit
m_delayedStop = 0.8f;
IActor* pActor = pActorSystem->GetActor(m_pSeat->GetPassenger());
if (pActor && pActor->IsPlayer())
{
// if stopped already don't go anywhere
IPhysicalEntity* pPhys = m_pVehicle->GetEntity()->GetPhysics();
pe_status_dynamics status;
if (pPhys && pPhys->GetStatus(&status))
{
if (status.v.GetLengthSquared() < 25.0f)
m_delayedStop = 0.0f;
}
if (m_actionForward > 0.0f)
m_delayedStop = 1.5f;
if (pMovement->GetMovementType() == IVehicleMovement::eVMT_Air)
m_delayedStop *= 2.0f;
m_pVehicle->SetObjectUpdate(this, IVehicle::eVOU_AlwaysUpdate);
// prevent full pedal being kept pressed, but give it a bit
pMovement->OnAction(eVAI_MoveForward, eAAM_OnPress, 0.1f);
}
else
{
if (pMovement->GetMovementType() == IVehicleMovement::eVMT_Air)
{
m_delayedStop = 0.0f;
m_pVehicle->SetObjectUpdate(this, IVehicle::eVOU_AlwaysUpdate);
}
else
{
pMovement->StopDriving();
}
}
}
示例7: BuildAnnouncement
//---------------------------------------
TAudioSignalID CAreaAnnouncer::BuildAnnouncement(const EntityId clientId)
{
const int k_areaCount = m_areaList.size();
if (k_areaCount > 0)
{
IActorSystem* pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
if (CActor* pClientActor = static_cast<CActor*>(pActorSystem->GetActor(clientId)))
{
int actorCount[k_maxAnnouncementAreas];
memset(&actorCount, 0, sizeof(actorCount));
CActorManager * pActorManager = CActorManager::GetActorManager();
pActorManager->PrepareForIteration();
const int kNumActors = pActorManager->GetNumActors();
const int kPlayerTeamId = g_pGame->GetGameRules()->GetTeam(clientId);
for (int i = 0; i < kNumActors; i++)
{
SActorData actorData;
pActorManager->GetNthActorData(i, actorData);
if(actorData.teamId != kPlayerTeamId && actorData.health > 0 && actorData.spectatorMode == CActor::eASM_None)
{
for (int areaIndex = 0; areaIndex < k_areaCount; areaIndex++)
{
IEntity* pEntity = gEnv->pEntitySystem->GetEntity(m_areaList[areaIndex].m_areaProxyId);
if(pEntity)
{
IEntityAreaProxy *pArea = (IEntityAreaProxy*)pEntity->GetProxy(ENTITY_PROXY_AREA);
if(pArea && pArea->CalcPointWithin(INVALID_ENTITYID, actorData.position, true))
{
actorCount[areaIndex]++;
break;
}
}
}
}
}
return GenerateAnnouncement(&actorCount[0], k_areaCount, clientId);
}
}
return INVALID_AUDIOSIGNAL_ID;
}
示例8: OnEnterVehicleSeat
//------------------------------------------------------------------------
void CVehicleClient::OnEnterVehicleSeat(IVehicleSeat* pSeat)
{
m_bMovementFlagRight=m_bMovementFlagLeft=m_bMovementFlagForward=m_bMovementFlagBack=false;
m_fLeftRight = m_fForwardBackward = 0.f;
IVehicle* pVehicle = pSeat->GetVehicle();
assert(pVehicle);
IActorSystem* pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
assert(pActorSystem);
IActor* pActor = pActorSystem->GetActor(pSeat->GetPassenger());
if (pActor)
{
bool isThirdPerson = pActor->IsThirdPerson() || m_tp;
TVehicleViewId viewId = InvalidVehicleViewId;
TVehicleViewId firstViewId = InvalidVehicleViewId;
while (viewId = pSeat->GetNextView(viewId))
{
if (viewId == firstViewId)
break;
if (firstViewId == InvalidVehicleViewId)
firstViewId = viewId;
if (IVehicleView* pView = pSeat->GetView(viewId))
{
if (pView->IsThirdPerson() == isThirdPerson)
break;
}
}
if (viewId != InvalidVehicleViewId)
pSeat->SetView(viewId);
if(IActor *pPassengerActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pSeat->GetPassenger()))
{
if(pPassengerActor->IsPlayer())
{
EnableActionMaps(pSeat, true);
}
}
}
}
示例9: CleanUpAbortedIntro
//-------------------------------------------------------------------------
void CGameRulesStandardState::CleanUpAbortedIntro()
{
CGameRules::TPlayers players;
m_pGameRules->GetPlayers(players);
IActorSystem* pActorSystem = g_pGame->GetIGameFramework()->GetIActorSystem();
CGameRules::TPlayers::const_iterator iter = players.begin();
CGameRules::TPlayers::const_iterator end = players.end();
while(iter != end)
{
CPlayer* pPlayer = static_cast<CPlayer*>( pActorSystem->GetActor( *iter ) );
if(pPlayer)
{
pPlayer->OnIntroSequenceFinished();
}
++iter;
}
}
示例10: OnEnterVehicleSeat
//------------------------------------------------------------------------
void CVehicleClient::OnEnterVehicleSeat(IVehicleSeat* pSeat)
{
m_bMovementFlagRight=m_bMovementFlagLeft=m_bMovementFlagForward=m_bMovementFlagBack=false;
m_fLeftRight = m_fForwardBackward = 0.f;
IVehicle* pVehicle = pSeat->GetVehicle();
assert(pVehicle);
IActorSystem* pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
assert(pActorSystem);
IActor* pActor = pActorSystem->GetActor(pSeat->GetPassenger());
bool isThirdPerson = pActor->IsThirdPerson() || m_tp;
TVehicleViewId viewId = InvalidVehicleViewId;
TVehicleViewId firstViewId = InvalidVehicleViewId;
while (viewId = pSeat->GetNextView(viewId))
{
if (viewId == firstViewId)
break;
if (firstViewId == InvalidVehicleViewId)
firstViewId = viewId;
if (IVehicleView* pView = pSeat->GetView(viewId))
{
if (pView->IsThirdPerson() == isThirdPerson)
break;
}
}
if (viewId != InvalidVehicleViewId)
pSeat->SetView(viewId);
IActionMapManager* pMapManager = gEnv->pGame->GetIGameFramework()->GetIActionMapManager();
assert(pMapManager);
pMapManager->EnableActionMap("landvehicle", false);
pMapManager->EnableActionMap("seavehicle", false);
pMapManager->EnableActionMap("helicopter", false);
pMapManager->EnableActionMap("vtol", false);
pMapManager->EnableFilter ( "vehicle_no_seat_change_and_exit", true );
}
示例11: DeployRope
//------------------------------------------------------------------------
bool CVehicleActionDeployRope::DeployRope()
{
IActorSystem* pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
assert(pActorSystem);
IActor* pActor = pActorSystem->GetActor(m_actorId);
if (!pActor)
return false;
Vec3 upperPos = m_pRopeHelper->GetWorldTM().GetTranslation();
Vec3 lowerPos(upperPos.x, upperPos.y, upperPos.z - g_ropeLenght);
m_ropeUpperId = CreateRope(m_pVehicle->GetEntity()->GetPhysics(), upperPos, upperPos);
m_ropeLowerId = CreateRope(pActor->GetEntity()->GetPhysics(), upperPos, lowerPos);
m_pVehicle->SetObjectUpdate(this, IVehicle::eVOU_AlwaysUpdate);
return true;
}
示例12: Revive
void CLocalPlayerComponent::Revive()
{
if(gEnv->bMultiplayer)
{
// Reset NotYetSpawned filter.
IActionFilter* pNYSFilter = g_pGameActions->FilterNotYetSpawned();
if(pNYSFilter && pNYSFilter->Enabled())
{
pNYSFilter->Enable(false);
}
// For Modes where we can swap teams per round, refresh everyone else's cloak colour on revive.
CGameRules *pGameRules = g_pGame->GetGameRules();
if( pGameRules->GetGameMode()==eGM_Gladiator )
{
IActorSystem* pActorSys = g_pGame->GetIGameFramework()->GetIActorSystem();
CActorManager* pActorManager = CActorManager::GetActorManager();
pActorManager->PrepareForIteration();
const int kNumActors = pActorManager->GetNumActors();
for(int i=0; i<kNumActors; i++)
{
SActorData actorData;
pActorManager->GetNthActorData(i, actorData);
if(CActor* pActor = static_cast<CActor*>(pActorSys->GetActor(actorData.entityId)))
{
if(pActor->IsCloaked())
{
pActor->SetCloakLayer(false);
pActor->SetCloakLayer(true);
}
}
}
}
}
m_bIsInFreeFallDeath = false;
m_playedMidHealthSound = false;
}
示例13: StartUsing
//------------------------------------------------------------------------
void CVehicleSeatActionMovement::StartUsing(EntityId passengerId)
{
IActorSystem* pActorSystem = CCryAction::GetCryAction()->GetIActorSystem();
CRY_ASSERT(pActorSystem);
IActor* pActor = pActorSystem->GetActor(passengerId);
CRY_ASSERT(pActor);
IVehicleMovement* pMovement = m_pVehicle->GetMovement();
CRY_ASSERT(pMovement);
if (!pMovement)
return;
if (m_delayedStop >= 0.0f)
{
m_pVehicle->SetObjectUpdate(this, IVehicle::eVOU_NoUpdate);
m_delayedStop = 0.0f;
pMovement->StopDriving();
}
pMovement->StartDriving(passengerId);
}
示例14: HideEntitySlots
//------------------------------------------------------------------------
void CVehicleViewFirstPerson::HideEntitySlots(IEntity* pEnt, bool hide)
{
IActorSystem* pActorSystem = CCryAction::GetCryAction()->GetIActorSystem();
CRY_ASSERT(pActorSystem);
if (hide)
{
for (int i=0; i<pEnt->GetSlotCount(); ++i)
{
if (pEnt->IsSlotValid(i) && pEnt->GetSlotFlags(i) & ENTITY_SLOT_RENDER)
{
if (pEnt->GetId() == m_pVehicle->GetEntity()->GetId())
{
// set character to always update
if (ICharacterInstance* pCharInstance = pEnt->GetCharacter(i))
{
pCharInstance->SetFlags(pCharInstance->GetFlags() | CS_FLAG_UPDATE_ALWAYS);
if (ISkeletonPose* pSkeletonPose = pCharInstance->GetISkeletonPose())
pSkeletonPose->SetForceSkeletonUpdate(10);
}
}
pEnt->SetSlotFlags(i, pEnt->GetSlotFlags(i) & ~ENTITY_SLOT_RENDER);
if (IActor* pActor = pActorSystem->GetActor(pEnt->GetId()))
{
pActor->HideAllAttachments(true);
}
// store slot; we must not reveal previously hidden slots later
m_slotFlags.insert( std::pair<EntityId,int>(pEnt->GetId(), i) );
}
}
// hide all children
for (int i=0; i<pEnt->GetChildCount(); ++i)
HideEntitySlots(pEnt->GetChild(i), hide);
}
else
{
// unhide all stored slots
for (TSlots::iterator it=m_slotFlags.begin(); it!=m_slotFlags.end(); ++it)
{
IEntity* pEntity = gEnv->pEntitySystem->GetEntity(it->first);
if (pEntity && pEntity->IsSlotValid(it->second))
{
pEntity->SetSlotFlags(it->second, pEntity->GetSlotFlags(it->second)|(ENTITY_SLOT_RENDER));
if (IActor* pActor = pActorSystem->GetActor(pEnt->GetId()))
{
pActor->HideAllAttachments(false);
}
if (pEntity->GetId() == m_pVehicle->GetEntity()->GetId())
{
// reset character flags
if (ICharacterInstance* pCharInstance = pEntity->GetCharacter(it->second))
{
pCharInstance->SetFlags(pCharInstance->GetFlags() & ~CS_FLAG_UPDATE_ALWAYS);
if (ISkeletonPose* pSkeletonPose = pCharInstance->GetISkeletonPose())
pSkeletonPose->SetForceSkeletonUpdate(0);
}
}
}
}
m_slotFlags.clear();
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:73,代码来源:VehicleViewFirstPerson.cpp
示例15: RespawnAI
//////////////////////////////////////////////////////////////////////////
//this respawns the active AI at their spawn locations
void CCheckpointSystem::RespawnAI(XmlNodeRef data)
{
if(!data)
return;
XmlNodeRef actorData = data->findChild(ACTOR_FLAGS_SECTION);
if(!actorData)
{
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_ERROR, "Failed reading actor data from checkpoint, actors won't be respawned");
return;
}
IActorSystem *pActorSystem = CCryAction::GetCryAction()->GetIActorSystem();
//first run through all actors and hide/deactivate them
IActorIteratorPtr it = pActorSystem->CreateActorIterator();
while (IActor *pActor = it->Next())
{
IEntity *pEntity = pActor->GetEntity();
//deactivate all actors
pEntity->Hide(true);
pEntity->Activate(false);
}
//load actorflags for active actors
XmlNodeRef activatedActors = actorData->findChild(ACTIVATED_ACTORS_SECTION);
if(activatedActors)
{
int actorFlags = activatedActors->getNumAttributes();
const char *key;
const char *value;
for(int i = 0; i < actorFlags; ++i)
{
activatedActors->getAttributeByIndex(i, &key, &value);
//format is "idXXX"
CRY_ASSERT(strlen(key)>2);
EntityId id = (EntityId)(atoi(&key[2]));
bool foundEntity = RepairEntityId(id, value);
if(foundEntity)
{
IActor* pActor = pActorSystem->GetActor(id);
if(pActor)
{
pActor->GetEntity()->Hide(false);
pActor->GetEntity()->Activate(true);
}
else
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_ERROR, "Failed finding actor %i from checkpoint.", (int)id);
}
else
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_ERROR, "Failed finding actor %s from checkpoint, actor is not setup correctly.", value);
}
}
else
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_ERROR, "Deactivated actors section was missing in checkpoint.");
it = pActorSystem->CreateActorIterator();
//iterate all actors and respawn if active
while (IActor *pActor = it->Next())
{
IEntity *pEntity = pActor->GetEntity();
if(pEntity->GetId() == LOCAL_PLAYER_ENTITY_ID) //don't respawn player
continue;
//we don't respawn deactivated actors
if(!pEntity->IsHidden() && pEntity->IsActive())
{
pActor->SetHealth(0);
pActor->Respawn();
}
else //but we still reset their position
{
pActor->ResetToSpawnLocation();
}
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:78,代码来源:CheckPointSystem.cpp