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

CTutorial@ pTutorial;
CLocalizer@ pLocalizer;
CGameText@ pText;
CMarvin@ pMarvin;
CGameObject@ pArrow1;
CGameObject@ pArrow2;

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

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


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

void EnterMeadows_1_1100()
{
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_1_1100"));
}

void EnterMeadows_1_1200()
{
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_1_1200"));
    pArrow1.SetVisible(true);
    pArrow2.SetVisible(true);
    ChangeSkinAnimation("Arrow1", "Data/GUI/AnimEntities/Anim/A_TutoArrowDown.ahsanimation");
    ChangeSkinAnimation("Arrow2", "Data/GUI/AnimEntities/Anim/A_TutoArrowDown.ahsanimation");
    CFloat2 pos;
    CGameObject@ pGrassSeed = pTutorial.GetGameObject("GrassSeed");
    pos = pGrassSeed.GetWorldPosition();
	pos.x += 35;
    pArrow1.SetPosition(pos);
    pos = pTutorial.GetGameObject("Farmland1").GetWorldPosition();
    pArrow2.SetPosition(pos);
}

void EnterMeadows_1_1300()
{
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_1_1300"));
    pArrow2.SetVisible(false);
    CGuiModule@ pModule = GetGuiManager().GetModule("InGame");
    CForm@ pForm = pModule.GetForm("MarvinCargo");
	CFloat2 pos;
	pos = GetGame().GetWorldPositionFromInterface(pForm.GetPosition(), pModule);
	pos.x += 137;
    pArrow1.SetWorldPosition(pos);
}

void EnterMeadows_1_1400()
{
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_1_1400"));
    CGuiModule@ pModule = GetGuiManager().GetModule("InGame");
    CForm@ pForm = pModule.GetForm("ObjectivesForm");
	CFloat2 pos;
	pos = GetGame().GetWorldPositionFromInterface(pForm.GetPosition(), pModule);
	pos.x += 80;
	pos.y += 70;
    pArrow1.SetWorldPosition(pos);
    ChangeSkinAnimation("Arrow1", "Data/GUI/AnimEntities/Anim/A_TutoArrowLeftUp.ahsanimation");
}

void EnterMeadows_1_1500()
{
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_1_1500"));
    ChangeSkinAnimation("Arrow1", "Data/GUI/AnimEntities/Anim/A_TutoArrowDown.ahsanimation");
    CGameObject@ pWell = pTutorial.GetGameObject("Well");
	CFloat2 pos;
	pos = pWell.GetWorldPosition();
	pos.x += 64;
	pos.y += 32;
    pArrow1.SetPosition(pos);
}

void EnterMeadows_1_1600()
{
    pArrow1.SetVisible(false);
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_1_1600"));
}

void EnterMeadows_1_1700()
{
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_1_1700"));
}

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

