Пример #1
0
	virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
			break;
		case eFE_Activate:
			IGameFramework* const pGameFramework = gEnv->pGame->GetIGameFramework();
			IGameObject* const pGameObject = pGameFramework->GetGameObject(pActInfo->pEntity->GetId());

			if(IsPortActive(pActInfo, EIP_Enslave) || IsPortActive(pActInfo, EIP_UnEnslave) )
			{
				IAnimatedCharacter* const pAnimChar = pGameObject ? (IAnimatedCharacter*) pGameObject->QueryExtension("AnimatedCharacter") : NULL;
				if(pAnimChar && pAnimChar->GetActionController())
				{
					const EntityId slaveChar = GetPortEntityId(pActInfo, EIP_Slave);
					IGameObject* pSlaveGameObject = pGameFramework->GetGameObject(slaveChar);
					IAnimatedCharacter* pSlaveAnimChar = pSlaveGameObject ? (IAnimatedCharacter*) pSlaveGameObject->QueryExtension("AnimatedCharacter") : NULL;

					if(pSlaveAnimChar && pSlaveAnimChar->GetActionController())
					{
						IAnimationDatabaseManager &dbManager = gEnv->pGame->GetIGameFramework()->GetMannequinInterface().GetAnimationDatabaseManager();
						uint32 db_crc32 = CCrc32::ComputeLowercase(GetPortString(pActInfo, EIP_DB));
						const IAnimationDatabase* db = dbManager .FindDatabase(db_crc32);

						const string& scopeContextName = GetPortString(pActInfo, EIP_ScopeContext);
						const string& requestedScopeContext = scopeContextName.empty() ? "SlaveChar" : scopeContextName;
						const TagID scopeContext = pAnimChar->GetActionController()->GetContext().controllerDef.m_scopeContexts.Find(scopeContextName.c_str());

						pAnimChar->GetActionController()->SetSlaveController(*pSlaveAnimChar->GetActionController(), scopeContext, IsPortActive(pActInfo, EIP_Enslave) ? true : false, db);
						ActivateOutput(pActInfo, EOP_Success, 1 );
					}
					else
					{
						CryWarning( VALIDATOR_MODULE_GAME, VALIDATOR_ERROR, "No GameObject or Animated character found for the slave");
						ActivateOutput(pActInfo, EOP_Fail, 1 );
					}
				}
				else
				{
					CryWarning( VALIDATOR_MODULE_GAME, VALIDATOR_ERROR, "No GameObject or AnimatedCharacter found");
					ActivateOutput(pActInfo, EOP_Fail, 1 );
				}
			}

			break;
		}
	}
Пример #2
0
void CActionCoopAnimation::RemoveTargetFromSlaveContext()
{
	IAnimatedCharacter* pTargetAnimChar = m_targetEntityID ? m_target.GetAnimatedCharacter() : NULL;
	IActionController* pTargetActionController = pTargetAnimChar ? pTargetAnimChar->GetActionController() : NULL;

	if(pTargetActionController)
	{
		IAnimatedCharacter* pAnimChar = m_player.GetAnimatedCharacter();
		IActionController* pActionController = pAnimChar->GetActionController();
		pActionController->SetSlaveController(*pTargetActionController, PlayerMannequin.contextIDs.SlaveChar, false, m_piOptionalTargetDatabase);

		CRecordingSystem* pRecordingSystem = g_pGame->GetRecordingSystem();
		if (pRecordingSystem)
		{
			pRecordingSystem->OnMannequinSetSlaveController(m_rootScope->GetEntityId(), pTargetActionController->GetEntityId(), PlayerMannequin.contextIDs.SlaveChar, false, m_piOptionalTargetDatabase);
		}
	}
	else
	{
		m_rootScope->GetActionController().ClearScopeContext(PlayerMannequin.contextIDs.SlaveChar);
	}
}
Пример #3
0
void CMountedGunController::InitMannequinParams()
{
    CRY_ASSERT(g_pGame);
    IGameFramework* pGameFramework = g_pGame->GetIGameFramework();
    CRY_ASSERT(pGameFramework);
    CMannequinUserParamsManager& mannequinUserParams = pGameFramework->GetMannequinInterface().GetMannequinUserParamsManager();

    CRY_ASSERT(m_pControlledPlayer);
    IAnimatedCharacter* pAnimatedCharacter = m_pControlledPlayer->GetAnimatedCharacter();
    CRY_ASSERT(pAnimatedCharacter);
    IActionController* pActionController = pAnimatedCharacter->GetActionController();
    m_pMannequinParams = mannequinUserParams.FindOrCreateParams<SMannequinMountedGunParams>(pActionController);

    MountedGunCRCs.Init();
}