class HoloDevice extends InteractiveDevice
{
	default m_controllerTypeName = 'HoloDeviceController';
	private instanceeditable var m_questFactName : CName;
	hint m_questFactName = "Fact is changing it's value depending on interaction: 0 - Default; 1 - Play; 2 - Stop";

	protected event OnRequestComponents( ri : EntityRequestComponentsInterface )
	{
		EntityRequestComponentsInterface.RequestComponent( ri, 'ui', 'worlduiWidgetComponent', false );
		super.OnRequestComponents( ri );
	}

	protected event OnTakeControl( ri : EntityResolveComponentsInterface )
	{
		m_uiComponent = ( ( worlduiWidgetComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'ui' ) ) );
		super.OnTakeControl( ri );
		m_controller = ( ( HoloDeviceController )( EntityResolveComponentsInterface.GetComponent( ri, 'controller' ) ) );
	}

	protected override function ResolveGameplayState()
	{
		super.ResolveGameplayState();
		if( IsUIdirty() && m_isInsideLogicArea )
		{
			RefreshUI();
		}
	}

	protected event OnPlay( evt : TogglePlay )
	{
		UpdateDeviceState();
		UpdateFactDB();
		UpdateUI();
	}

	private function UpdateFactDB()
	{
		var factValue : Int32;
		if( m_questFactName != 'None' )
		{
			factValue = 2;
			if( GetDevicePS().IsPlaying() )
			{
				factValue = 1;
			}
			AddFact( GetGame(), m_questFactName );
			SetFactValue( GetGame(), m_questFactName, factValue );
		}
	}

	private function UpdateUI() {}

	private const override function GetController() : HoloDeviceController
	{
		return ( ( HoloDeviceController )( m_controller ) );
	}

	public const override function GetDevicePS() : HoloDeviceControllerPS
	{
		return GetController().GetPS();
	}

}

