class inkDexLimoGameController extends inkGameController
{
	private var m_activeVehicleBlackboard : weak< IBlackboard >;
	private var m_playerVehStateId : CallbackHandle;
	private var m_screenVideoWidget : weak< inkVideo >;
	private editable var m_screenVideoWidgetPath : CName;
	private editable var m_videoPath : ResRef;

	protected event OnInitialize()
	{
		m_activeVehicleBlackboard = GetBlackboardSystem().Get( GetAllBlackboardDefs().UI_ActiveVehicleData );
		if( m_activeVehicleBlackboard )
		{
			m_playerVehStateId = m_activeVehicleBlackboard.RegisterListenerVariant( GetAllBlackboardDefs().UI_ActiveVehicleData.VehPlayerStateData, this, 'OnPlayerStateChanged' );
		}
	}

	protected event OnUninitialize()
	{
		if( m_activeVehicleBlackboard )
		{
			m_activeVehicleBlackboard.UnregisterListenerVariant( GetAllBlackboardDefs().UI_ActiveVehicleData.VehPlayerStateData, m_playerVehStateId );
		}
	}

	protected event OnPlayerStateChanged( data : Variant )
	{
		var newData : VehEntityPlayerStateData;
		var entID : EntityID;
		var vehEntityID : EntityID;
		var playerState : Int32;
		newData = ( ( VehEntityPlayerStateData )data );
		vehEntityID = newData.entID;
		entID = GetOwnerEntity().GetEntityID();
		playerState = newData.state;
		if( entID == vehEntityID )
		{
			m_screenVideoWidget = ( ( inkVideo )( GetWidget( m_screenVideoWidgetPath ) ) );
			if( playerState > ( ( Int32 )( gamePSMVehicle.Default ) ) )
			{
				m_screenVideoWidget.SetVideoPath( m_videoPath );
				m_screenVideoWidget.SetLoop( true );
				m_screenVideoWidget.Play();
			}
			else
			{
				m_screenVideoWidget.Stop();
			}
		}
	}

}

