void ProcessEvent(EFlowEvent event, SActivationInfo* pActInfo)
	{
#if !defined(_RELEASE)
		if (event == eFE_Initialize && IsPortActive(pActInfo, eIP_Draw))
		{
			m_waitTime = 0.0f;
			pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, false);
		}
		else if (event == eFE_Activate && IsPortActive(pActInfo, eIP_Draw))
		{
			IEntity* pEntity = pActInfo->pEntity;
			if (pEntity)
			{
				IPersistantDebug* pPersistentDebug = CCryAction::GetCryAction()->GetIPersistantDebug();
				if (pPersistentDebug)
				{
					SEntityTagParams params;
					params.entity = pEntity->GetId();
					params.text = GetPortString(pActInfo, eIP_Message);
					params.size = GetPortFloat(pActInfo, eIP_FontSize);
					params.color = ColorF(GetPortVec3(pActInfo, eIP_Color), 1.0f);
					params.visibleTime = GetPortFloat(pActInfo, eIP_Time);
					params.fadeTime = GetPortFloat(pActInfo, eIP_FadeTime);
					params.viewDistance = GetPortFloat(pActInfo, eIP_ViewDistance);
					params.staticId = GetPortString(pActInfo, eIP_StaticID);
					params.column = GetPortInt(pActInfo, eIP_Column);
					params.tagContext = "FG_DrawEntityTagAdvanced";

					pPersistentDebug->AddEntityTag(params);

					m_waitTime = gEnv->pTimer->GetFrameStartTime() + (params.fadeTime + params.visibleTime);
					pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, true);
				}
			}
		}
		else if (event == eFE_Update)
		{
			if (m_waitTime < gEnv->pTimer->GetFrameStartTime())
			{
				m_waitTime.SetSeconds(0.0f);
				pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, false);
				ActivateOutput(pActInfo, eOP_Done, GetPortAny(pActInfo, eIP_Draw));
			}
		}
#endif
	}
Пример #2
0
//-------------------------------------------------------------------------
// Required Params: entityId, const char *text
// Optional Params: float size, Vec3 color, float visibleTime, float fadeTime, float viewDistance, const char* staticId, int columnNum, const char* contextTag
int CScriptBind_Action::PersistantEntityTag(IFunctionHandler* pH, ScriptHandle entityId, const char *text)
{
	IPersistantDebug* pPD = CCryAction::GetCryAction()->GetIPersistantDebug();

	SEntityTagParams params;
	params.entity = (EntityId)entityId.n;
	params.text = text;
	params.tagContext = "scriptbind";

	// Optional params
	if (pH->GetParamType(3) != svtNull) // Size
		pH->GetParam(3, params.size);
	if (pH->GetParamType(4) != svtNull) // Color
	{
		Vec3 color;
		pH->GetParam(4, color);
		params.color = ColorF(color, 1.f);
	}
	if (pH->GetParamType(5) != svtNull) // Visible Time
		pH->GetParam(5, params.visibleTime);
	if (pH->GetParamType(6) != svtNull) // Fade Time
		pH->GetParam(6, params.fadeTime);
	if (pH->GetParamType(7) != svtNull) // View Distance
		pH->GetParam(7, params.viewDistance);
	if (pH->GetParamType(8) != svtNull) // Static ID
	{
		const char *staticId;
		pH->GetParam(8, staticId);
		params.staticId = staticId;
	}
	if (pH->GetParamType(9) != svtNull) // Column Num
		pH->GetParam(9, params.column);
	if (pH->GetParamType(10) != svtNull) // Context Tag
	{
		const char *tagContext;
		pH->GetParam(10, tagContext);
		params.tagContext = tagContext; // overrides default one set above
	}

	pPD->AddEntityTag(params);
	
	return pH->EndFunction();
}