本文整理汇总了C++中IActorSystem类的典型用法代码示例。如果您正苦于以下问题:C++ IActorSystem类的具体用法?C++ IActorSystem怎么用?C++ IActorSystem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IActorSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
}
示例2: ProcessEvent
virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
{
switch (event)
{
case eFE_Initialize:
case eFE_Activate:
{
IActorSystem *pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
IActorIteratorPtr actorIt = pActorSystem->CreateActorIterator();
int iNumPlayers = 0;
IActor *pActor = actorIt->Next();
while(iNumPlayers < 4 && pActor)
{
if(pActor->GetChannelId())
{
ActivateOutput(pActInfo, iNumPlayers, pActor->GetEntityId());
++iNumPlayers;
}
pActor = actorIt->Next();
}
}
break;
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:25,代码来源:FlowGameNodes.cpp
示例3: 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");
}
}
}
}
}
示例4: 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);
}
}
}
示例5: 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;
}
示例6: assert
//--------------------------------------------------------------
void CWeaponSystem::OnGameTokenEvent( EGameTokenEvent event,IGameToken *pGameToken )
{
assert(pGameToken);
if(EGAMETOKEN_EVENT_CHANGE == event)
{
bool handled = false;
if(!strcmp("weapon.effects.ice",pGameToken->GetName()))
{
pGameToken->GetValueAs(m_frozenEnvironment);
handled = true;
}
else if(!strcmp("weapon.effects.wet",pGameToken->GetName()))
{
pGameToken->GetValueAs(m_wetEnvironment);
handled = true;
}
if (handled)
{
IGameFramework* pGF = gEnv->pGame->GetIGameFramework();
IActorSystem* pAS = pGF->GetIActorSystem();
int count = pAS->GetActorCount();
if (count)
{
IActorIteratorPtr it = pAS->CreateActorIterator();
while (CActor* pActor = (CActor*)it->Next())
{
CPlayer *pPlayer = (pActor->GetActorClass() == CPlayer::GetActorClassType()) ? static_cast<CPlayer*>(pActor) : 0;
if (pPlayer && pPlayer->GetNanoSuit())
{
// go through all players and turn their ice effects on/off
IEntityRenderProxy* pRenderProxy = (IEntityRenderProxy*)pPlayer->GetEntity()->GetProxy(ENTITY_PROXY_RENDER);
if (pRenderProxy)
{
uint8 mask = pRenderProxy->GetMaterialLayersMask();
uint32 blend = pRenderProxy->GetMaterialLayersBlend();
mask = IsFrozenEnvironment() ? mask|MTL_LAYER_DYNAMICFROZEN : mask&~MTL_LAYER_DYNAMICFROZEN;
mask = IsWetEnvironment() ? mask|MTL_LAYER_WET : mask&~MTL_LAYER_WET;
pRenderProxy->SetMaterialLayersMask(mask);
pRenderProxy->SetMaterialLayersBlend(blend);
if (CItem* pItem = static_cast<CItem*>(pPlayer->GetCurrentItem(true)))
{
pItem->FrostSync(true);
pItem->WetSync(true);
}
if (COffHand* pOffHand = static_cast<COffHand*>(pPlayer->GetItemByClass(CItem::sOffHandClass)))
{
pOffHand->FrostSync(pOffHand->GetOffHandState() != eOHS_INIT_STATE);
pOffHand->WetSync(pOffHand->GetOffHandState() != eOHS_INIT_STATE);
}
}
}
}
}
}
}
}
示例7: 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();
}
}
示例8: 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();
}
}
}
示例9: 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;
}
示例10: OnActionDebugNextActor
bool CPlayerInput::OnActionDebugNextActor(EntityId entityId, const ActionId& actionId, int activationMode, float value)
{
IActorSystem* pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
if (pActorSystem->GetActorCount() > 1)
{
EntityId currentEntityId = pActorSystem->SwitchDemoSpectator(0);
// Remote players should be viewed only in 3D mode with cl_cam_orbit set to 1
bool isPlayerViewed = (currentEntityId == entityId);
m_pPlayer->SetThirdPerson(!isPlayerViewed);
g_pGameCVars->cl_cam_orbit = isPlayerViewed ? 0 : 1;
}
return false;
}
示例11: 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;
}
}
示例12: assert
//------------------------------------------------------------------------
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);
}
}
}
}
示例13: assert
//------------------------------------------------------------------------
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 );
}
示例14: 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;
}
示例15: 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;
}