#include "Data/Levels/Common/Tutorial/Scripts/Utilities.bhass"

CTutorial@ pTutorial;
CLocalizer@ pLocalizer;
CGameText@ pText;
CMarvin@ pMarvin;
CGameObject@ pArrow;

//------------------------------------------------ Init/Release ---------------------------------------------------
void InitTutorial()
{
    @pTutorial = GetGame().GetCurrentLevel().GetTutorial();
    @pLocalizer = GetGame().GetLocalizer();
    @pText = pTutorial.GetGameText("Text");
    @pMarvin = GetGame().GetCurrentLevel().GetMarvin();
    @pArrow = pTutorial.GetGameObject("Arrow");
    GetGame().GetCurrentLevel().Deactivate();
    pMarvin.Deactivate();
}

void ReleaseTutorial()
{
    pMarvin.Activate();
    GetGame().GetCurrentLevel().Activate();
}


//------------------------------------------------ Script Functions ---------------------------------------------------
void EnterMeadows_4_1300()
{
    pTutorial.GetGameObject("Dialog").SetVisible(true);
    pText.SetVisible(true);
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_4_1300"));
}

void EnterMeadows_4_1400()
{
    pArrow.SetVisible(true);
    pArrow.SetPosition(pTutorial.GetGameObject("Incubator").GetWorldPosition());
    ChangeSkinAnimation("Arrow", "Data/GUI/AnimEntities/Anim/A_TutoArrowDown.ahsanimation");
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_4_1400"));
}

void EnterMeadows_4_1500()
{
	ChangeSkinAnimation("Arrow", "Data/GUI/AnimEntities/Anim/A_TutoArrowLeftUp.ahsanimation");
	CFloat2 pos;
	pos = pTutorial.GetGameObject("Oil").GetWorldPosition();
	pos.x += 80;
	pos.y = -30;
    pArrow.SetPosition(pos);
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_4_1500"));
}

void EnterMeadows_4_1600()
{
    pArrow.SetVisible(false);
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_4_1600"));
}

void EnterMeadows_4_1700()
{
    if( GetGame().GetCurrentLevel().HasTimerGauge() )
    {
        pText.SetText(pLocalizer.LocalizeText("MEADOWS_4_1700"));
    }
    else
    {
        pText.SetText(pLocalizer.LocalizeText("MEADOWS_4_1700_CASU"));
    }
}

void EnterMeadows_4_1800()
{
    if( GetGame().GetCurrentLevel().HasTimerGauge() )
    {
        pArrow.SetVisible(true);
        ChangeSkinAnimation("Arrow", "Data/GUI/AnimEntities/Anim/A_TutoArrowDown.ahsanimation");
	    CFloat2 pos;
        CGuiModule@ pModule = GetGuiManager().GetModule("InGame");
        CForm@ pForm = pModule.GetForm("TimerGauge");
	    pos = GetGame().GetWorldPositionFromInterface(pForm.GetPosition(), pModule);
	    pos.x += 120;
	    pos.y -= 10;
        pArrow.SetWorldPosition(pos);
        pText.SetText(pLocalizer.LocalizeText("MEADOWS_4_1800"));
    }
    else
    {
        pText.SetText(pLocalizer.LocalizeText("MEADOWS_4_1800_CASU"));
    }
}

void EnterMeadows_4_1900()
{
    if( GetGame().GetCurrentLevel().HasTimerGauge() )
    {
        pArrow.SetVisible(false);
        pText.SetText(pLocalizer.LocalizeText("MEADOWS_4_1900"));
    }
    else
    {
        pText.SetText(pLocalizer.LocalizeText("MEADOWS_4_1900_CASU"));
    }
}

void EnterMeadows_4_2000()
{
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_4_2000"));
}

void ExitMeadows_4_2000()
{
    pTutorial.GetGameObject("Dialog").SetVisible(false);
    pText.SetVisible(false);
}

