本文整理汇总了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(<ime);
tm *pTm = localtime(<ime);
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);
}
}