import class RoachRacePlayerController extends MinigamePlayerController
{
	private editable var m_runAnimation : CName;
	private editable var m_jumpAnimation : CName;
	private var m_currentAnimation : inkAnimProxy;

	private function Run()
	{
		var animationOptions : inkAnimOptions;
		animationOptions = inkAnimOptions();
		animationOptions.loopInfinite = true;
		animationOptions.loopType = inkanimLoopType.Cycle;
		if( m_currentAnimation.IsValid() )
		{
			m_currentAnimation.Stop();
		}
		m_currentAnimation = PlayLibraryAnimationOnTargets( m_runAnimation, SelectWidgets( GetRootWidget() ), animationOptions );
	}

	private function Jump()
	{
		var animationOptions : inkAnimOptions;
		animationOptions = inkAnimOptions();
		if( m_currentAnimation.IsValid() )
		{
			m_currentAnimation.Stop();
		}
		m_currentAnimation = PlayLibraryAnimationOnTargets( m_jumpAnimation, SelectWidgets( GetRootWidget() ), animationOptions );
	}

	protected event OnJumpStart()
	{
		Jump();
	}

	protected event OnDie()
	{
		if( m_currentAnimation.IsValid() )
		{
			m_currentAnimation.Stop();
		}
	}

	protected event OnJumpEnd()
	{
		Run();
	}

	protected event OnRun()
	{
		Run();
	}

}

