class RoboticArms extends InteractiveDevice
{
	default m_controllerTypeName = 'RoboticArmsController';
	[ category = "SFX" ][ customEditor = "AudioEvent" ]
	instanceeditable var m_workSFX : CName;
	[ category = "SFX" ][ customEditor = "AudioEvent" ]
	instanceeditable var m_distractSFX : CName;
	private var m_animationController : AnimationControllerComponent;
	private var m_animFeature : AnimFeature_RoboticArm;

	protected event OnRequestComponents( ri : EntityRequestComponentsInterface )
	{
		EntityRequestComponentsInterface.RequestComponent( ri, 'audio', 'soundComponent', false );
		EntityRequestComponentsInterface.RequestComponent( ri, 'animController', 'AnimationControllerComponent', false );
		super.OnRequestComponents( ri );
	}

	protected event OnTakeControl( ri : EntityResolveComponentsInterface )
	{
		super.OnTakeControl( ri );
		m_animationController = ( ( AnimationControllerComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'animController' ) ) );
		if( !( m_animationController ) )
		{
		}
		m_controller = ( ( RoboticArmsController )( EntityResolveComponentsInterface.GetComponent( ri, 'controller' ) ) );
	}

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

	protected override function ResolveGameplayState()
	{
		super.ResolveGameplayState();
		m_animFeature = new AnimFeature_RoboticArm;
		SetWorkState();
	}

	protected event OnQuickHackDistraction( evt : QuickHackDistraction )
	{
		if( evt.IsStarted() )
		{
			SetDistractState();
		}
		else
		{
			SetWorkState();
		}
	}

	private function SetDistractState()
	{
		StopWorkSFX();
		PlayDistractSFX();
		SetAnimationState( RoboticArmStateType.Distract );
	}

	private function SetWorkState()
	{
		StopDistractSFX();
		PlayWorkSFX();
		SetAnimationState( RoboticArmStateType.Work );
	}

	private function SetAnimationState( state : RoboticArmStateType )
	{
		m_animFeature.state = ( ( Int32 )( state ) );
		AnimationControllerComponent.ApplyFeature( this, 'Robotic_arm', m_animFeature );
	}

	private function PlayWorkSFX()
	{
		PlaySound( this, m_workSFX );
	}

	private function StopWorkSFX()
	{
		StopSound( this, m_workSFX );
	}

	private function PlayDistractSFX()
	{
		PlaySound( this, m_distractSFX );
	}

	private function StopDistractSFX()
	{
		StopSound( this, m_distractSFX );
	}

}

