class MovableWallScreen extends Door
{
	default m_controllerTypeName = 'MovableWallScreenController';
	private editable var m_animationLength : Float;
	private var m_animFeature : AnimFeature_SimpleDevice;

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

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

	protected event OnGameAttached()
	{
		super.OnGameAttached();
		UpdateAnimState();
	}

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

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

	protected event OnToggleOpen( evt : ToggleOpen )
	{
		if( GetDevicePS().IsOpen() )
		{
		}
		UpdateAnimState();
		PlaySounds();
	}

	private function UpdateAnimState()
	{
		if( !( m_animFeature ) )
		{
			m_animFeature = new AnimFeature_SimpleDevice;
		}
		m_animFeature.isOpen = false;
		if( GetDevicePS().IsOpen() )
		{
			m_animFeature.isOpen = true;
		}
		AnimationControllerComponent.ApplyFeature( this, 'DeviceMovableWallScreen', m_animFeature );
	}

	private function PlaySounds()
	{
		if( GetDevicePS().IsOpen() )
		{
			GameObject.PlaySoundEvent( this, 'dev_doors_v_room_secret_open' );
		}
		else
		{
			GameObject.PlaySoundEvent( this, 'dev_doors_v_room_secret_close' );
		}
	}

	protected function SetQuestFact( factName : CName )
	{
		if( IsNameValid( factName ) )
		{
			SetFactValue( GetGame(), factName, 1 );
		}
	}

	protected event OnSecretOpenAnimationEvent( evt : SecretOpenAnimationEvent ) {}
}

class SecretOpenAnimationEvent extends Event
{
}

