本文整理汇总了C++中CGameRules::GetSpawningModule方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameRules::GetSpawningModule方法的具体用法?C++ CGameRules::GetSpawningModule怎么用?C++ CGameRules::GetSpawningModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameRules
的用法示例。
在下文中一共展示了CGameRules::GetSpawningModule方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnActorAction
void CGameRulesMPActorAction::OnActorAction(IActor *pActor, const ActionId& actionId, int activationMode, float value)
{
CActor *pActorImpl = static_cast<CActor *>(pActor);
if (pActorImpl)
{
EntityId pid = pActor->GetEntityId(); // player id
CGameRules *pGameRules = g_pGame->GetGameRules();
IGameRulesSpectatorModule *specmod = pGameRules->GetSpectatorModule();
if (!specmod || (pActorImpl->GetSpectatorMode() <= 0))
{
// Not in spectator mode
if (pActorImpl->IsDead())
{
// if dead
CRecordingSystem *crs = g_pGame->GetRecordingSystem();
if (crs != NULL && crs->IsPlayingBack())
{
// Recording system playing back
if (actionId == g_pGame->Actions().spectate_gen_skipdeathcam && g_pGameCVars->kc_canSkip )
crs->StopPlayback();
}
else if ((actionId == g_pGame->Actions().spectate_gen_spawn || actionId == g_pGame->Actions().hud_mouseclick) && activationMode == eAAM_OnPress && pActorImpl->GetSpectatorState() != CActor::eASS_SpectatorMode)
{
// Revive requested.
// This may happen immediately or not at all.
if (IGameRulesSpawningModule* pSpawningModule=pGameRules->GetSpawningModule())
{
IGameRulesStateModule* stateModule = pGameRules->GetStateModule();
if (!stateModule || (stateModule->GetGameState() != IGameRulesStateModule::EGRS_PostGame))
{
CryLog("CGameRulesMPActorAction::OnActorAction() Requesting revive");
pSpawningModule->ClRequestRevive(pActor->GetEntityId());
}
}
}
else if ((specmod != NULL && specmod->CanChangeSpectatorMode(pid)) && (((actionId == g_pGame->Actions().spectate_gen_nextmode) || (actionId == g_pGame->Actions().spectate_gen_prevmode)) && (activationMode == eAAM_OnPress)))
{
// get into spectate mode
if (!crs || !crs->IsPlayingOrQueued())
{
specmod->ChangeSpectatorModeBestAvailable(pActor, false);
}
}
}
}
else
{
// is spectating
int curspecmode = pActorImpl->GetSpectatorMode();
int curspecstate = pActorImpl->GetSpectatorState();
const CRecordingSystem* pRecordingSystem = g_pGame->GetRecordingSystem();
// actions general across almost all spectator modes
if( (curspecmode == CActor::eASM_Killer && !g_pGameCVars->g_killercam_canSkip) || (pRecordingSystem && pRecordingSystem->IsPlayingBack()) )
{
// Can't change mode or respawn-request, when in KillerCam mode or watching Killcam.
}
else if ((actionId == g_pGame->Actions().spectate_gen_spawn) && (activationMode == eAAM_OnPress) && pActorImpl->GetSpectatorState() != CActor::eASS_SpectatorMode)
{
IGameRulesSpawningModule *pSpawningModule = pGameRules->GetSpawningModule();
if (pSpawningModule)
{
IGameRulesStateModule* stateModule = pGameRules->GetStateModule();
if (!stateModule || (stateModule->GetGameState() != IGameRulesStateModule::EGRS_PostGame))
{
CryLog("CGameRulesMPActorAction::OnActorAction() Spectating, received spectate_gen_spawn action, requesting revive");
pSpawningModule->ClRequestRevive(pActor->GetEntityId());
}
}
}
else if (((actionId == g_pGame->Actions().spectate_gen_nextmode) || (actionId == g_pGame->Actions().spectate_gen_prevmode)) && (activationMode == eAAM_OnPress))
{
CryLog("[tlh] > changemode button pressed");
if (specmod->CanChangeSpectatorMode(pid))
{
CryLog("[tlh] > can change");
int mode;
EntityId othEntId;
mode = specmod->GetNextMode(pid, ((actionId == g_pGame->Actions().spectate_gen_nextmode) ? 1 : -1), &othEntId);
if (mode != curspecmode)
{
CryLog("[tlh] > changing to mode %d with othEnt %d",mode,othEntId);
specmod->ChangeSpectatorMode(pActor, mode, othEntId, false);
}
}
}
else
{
// actions specific to individual spectator modes
if (specmod->CanChangeSpectatorMode(pid)) // "CanChangeSpectatorMode?" is essentially "CanInteractWithSpectatorMode?" - ie. we don't want to be able to do any of this on the Join Game screen
{
if (curspecmode == CActor::eASM_Fixed)
//.........这里部分代码省略.........