class TutorialMainController extends inkGameController
{
	private editable var m_instructionPanel : inkWidgetRef;
	private editable var m_instructionDesc : inkTextRef;
	private editable var m_pointer : inkWidgetRef;
	private var m_tutorialActive : Bool;
	private var m_currentTutorialStep : TutorialStep;

	protected event OnInitialize()
	{
		m_tutorialActive = false;
	}

	protected event OnUnitialize() {}

	public function StartTutorial()
	{
		m_tutorialActive = true;
	}

	public function UpdateTutorialStep( const step : ref< TutorialStep > )
	{
		var pointerPos : inkMargin;
		m_currentTutorialStep = step;
		if( m_currentTutorialStep.description != "" )
		{
			inkWidgetRef.SetVisible( m_instructionPanel, true );
			inkTextRef.SetText( m_instructionDesc, m_currentTutorialStep.description );
		}
		else
		{
			inkWidgetRef.SetVisible( m_instructionPanel, false );
		}
		if( m_currentTutorialStep.showPointer )
		{
			inkWidgetRef.SetVisible( m_pointer, true );
			inkWidgetRef.SetRotation( m_pointer, m_currentTutorialStep.pointerRotation );
			pointerPos.left = m_currentTutorialStep.pointerXPos;
			pointerPos.top = m_currentTutorialStep.pointerYPos;
			inkWidgetRef.SetMargin( m_pointer, pointerPos );
		}
		else
		{
			inkWidgetRef.SetVisible( m_pointer, false );
		}
	}

	public function CompleteTutorial()
	{
		m_tutorialActive = false;
	}

	public function IsTutorialActive() : Bool
	{
		return m_tutorialActive;
	}

}

struct TutorialStep
{
	var description : String;
	var showPointer : Bool;
	var pointerRotation : Float;
	var pointerXPos : Float;
	var pointerYPos : Float;
	var allowedActions : array< CName >;
}

