예제 #1
0
//--------------------------------------------------------------------------------------------------
// Name: ~CGameEffect
// Desc: Destructor
//--------------------------------------------------------------------------------------------------
CGameEffect::~CGameEffect()
{
#if DEBUG_GAME_FX_SYSTEM
	// Output message if effect hasn't been released before being deleted
	const bool bEffectIsReleased = (m_flags & GAME_EFFECT_RELEASED) ||			// -> Needs to be released before deleted
																 !(m_flags & GAME_EFFECT_INITIALISED) ||	// -> Except when not initialised
																 (gEnv->IsEditor());											// -> Or the editor (memory safely released by editor)
	if(!bEffectIsReleased)
	{
		string dbgMessage = m_debugName + " being destroyed without being released first";
		FX_ASSERT_MESSAGE(bEffectIsReleased,dbgMessage.c_str());
	}
#endif

	if(CGameEffectsSystem::Exists())
	{
		GAME_FX_SYSTEM.UnRegisterEffect(this);	// -> Effect should have been released and been unregistered, but to avoid
																						//    crashes call unregister here too
	}

	// Unregister as ViewSystem listener (for cut-scenes, ...)
	if (g_pGame)
	{
		IViewSystem *pViewSystem = g_pGame->GetIGameFramework()->GetIViewSystem();
		if (pViewSystem)
		{
			pViewSystem->RemoveListener(this);
		}
	}
}//-------------------------------------------------------------------------------------------------
예제 #2
0
//---------------------------------
CScreenEffects::~CScreenEffects(void)
{
	ClearAllBlendGroups(false);

	// Unregister as ViewSystem listener (for cut-scenes, ...)
	IViewSystem *pViewSystem = g_pGame->GetIGameFramework()->GetIViewSystem();
	if (pViewSystem)
	{
		pViewSystem->RemoveListener(this);
	}

	// Unregister as System listener
	if (gEnv->pSystem)
	{
		gEnv->pSystem->GetISystemEventDispatcher()->RemoveListener( this );
	}
}
예제 #3
0
//---------------------------------
void CScreenEffects::OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam)
{
	IViewSystem *pViewSystem = g_pGame->GetIGameFramework()->GetIViewSystem();
	if (pViewSystem)
	{
		switch ( event )
		{
		case ESYSTEM_EVENT_LEVEL_GAMEPLAY_START:
			// Register as ViewSystem listener (for cut-scenes, ...)
			pViewSystem->AddListener(this);
			break;
		case ESYSTEM_EVENT_LEVEL_UNLOAD:
			// Unregister as ViewSystem listener (for cut-scenes, ...)
			pViewSystem->RemoveListener(this);
			break;
		}
	}
}