class PachinkoMachine extends ArcadeMachine
{
	default m_arcadeMachineType = ArcadeMachineType.Pachinko;
	protected var m_distractionFXName : CName;
	default m_distractionFXName = 'effect_distraction';

	protected event OnRequestComponents( ri : EntityRequestComponentsInterface )
	{
		super.OnRequestComponents( ri );
	}

	protected event OnTakeControl( ri : EntityResolveComponentsInterface )
	{
		super.OnTakeControl( ri );
		m_controller = ( ( PachinkoMachineController )( EntityResolveComponentsInterface.GetComponent( ri, 'controller' ) ) );
	}

	protected event OnGameAttached()
	{
		super.OnGameAttached();
		GameObject.PlayMetadataEvent( this, 'dev_pachinko_music_loop' );
	}

	protected const override function GetController() : PachinkoMachineController
	{
		return ( ( PachinkoMachineController )( m_controller ) );
	}

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

	protected override function TurnOffScreen()
	{
		m_uiComponent.Toggle( false );
		PlaySound( this, m_currentGameAudioStop );
	}

	protected override function TurnOnScreen()
	{
		m_uiComponent.Toggle( true );
		PlaySound( this, m_currentGameAudio );
	}

	protected function RefreshDeviceInteractions()
	{
		var playerPuppet : PlayerPuppet;
		playerPuppet = ( ( PlayerPuppet )( GameInstance.GetPlayerSystem( GetGame() ).GetLocalPlayerMainGameObject() ) );
		RefreshInteraction( gamedeviceRequestType.Direct, playerPuppet );
	}

	protected event OnQuickHackDistraction( evt : QuickHackDistraction )
	{
		super.OnQuickHackDistraction( evt );
		if( evt.IsCompleted() )
		{
			GameObjectEffectHelper.BreakEffectLoopEvent( this, m_distractionFXName );
			RefreshDeviceInteractions();
		}
		else
		{
			GameObjectEffectHelper.StartEffectEvent( this, m_distractionFXName );
		}
	}

	public const override function DeterminGameplayRole() : EGameplayRole
	{
		return EGameplayRole.Distract;
	}

}

