当前位置: 首页>>代码示例>>C++>>正文


C++ IAIObject::RecordEvent方法代码示例

本文整理汇总了C++中IAIObject::RecordEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ IAIObject::RecordEvent方法的具体用法?C++ IAIObject::RecordEvent怎么用?C++ IAIObject::RecordEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAIObject的用法示例。


在下文中一共展示了IAIObject::RecordEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddRecordBookmark

void CGameAIRecorder::AddRecordBookmark(EntityId requesterId)
{
	assert(requesterId > 0);
	assert(gEnv->bServer);

	if (m_bIsRecording)
	{
		if (!gEnv->bServer)
		{
			CryLogAlways("[AI] Recorder bookmark requested on Client. Only the Server can do this!");
			return;
		}

		IEntity *pEntity = gEnv->pEntitySystem->GetEntity(requesterId);
		IAIObject *pAI = pEntity ? pEntity->GetAI() : NULL;
		if (!pAI)
		{
			CryLogAlways("[AI] Attempting to add recorder bookmark, but the requester does not have an AI!");
			return;
		}

		static int g_iBookmarkCounter = 0;
		int iBookmark = ++g_iBookmarkCounter;

		// (Kevin) We need to unify the timestamp for this, which should be set when the Recorder itself starts.
		//	This way, all screenshots will match up with the recorder per date/time/build. Then we need to
		//	move these into subfolders that contain the date/time/build as the name. (10/08/2009)

		time_t ltime;
		time(&ltime);
		tm *pTm = localtime(&ltime);
		char szDate[128];
		strftime(szDate, 128, "Date(%d %b %Y) Time(%H %M %S)", pTm);

		// Get current version line
		const SFileVersion& fileVersion = gEnv->pSystem->GetFileVersion();

		const bool bTakeScreenshot = (requesterId == g_pGame->GetIGameFramework()->GetClientActorId());

		// Output to log
		CryLogAlways("[AI] --- RECORDER BOOKMARK ADDED ---");
		CryLogAlways("[AI] Id: %d", iBookmark);
		CryLogAlways("[AI] %s", szDate);
		CryLogAlways("[AI] By: %s", pEntity->GetName());

		if (!bTakeScreenshot)
		{
			CryLogAlways("[AI] No Screenshot was made for this bookmark, because requester is not the server!");
		}
		else
		{
			string sScreenShotFile;
			sScreenShotFile.Format("Recorder_Bookmark(%d) Build(%d) %s", iBookmark, fileVersion[0], szDate);

			const string sScreenShotPath = PathUtil::Make("Recordings", sScreenShotFile.c_str(), "jpg");

			// Take screenshot
			CryLogAlways("[AI] Screenshot: \'%s\'", sScreenShotPath.c_str());
			gEnv->pRenderer->ScreenShot(sScreenShotPath.c_str());

			OnAddBookmark(sScreenShotPath);
		}

		// Add bookmark to stream
		IAIRecordable::RecorderEventData data((float)iBookmark);
		pAI->RecordEvent(IAIRecordable::E_BOOKMARK, &data);
	}
}
开发者ID:danielasun,项目名称:dbho-GameSDK,代码行数:68,代码来源:GameAIRecorder.cpp


注:本文中的IAIObject::RecordEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。