#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");
    GetGame().GetCurrentLevel().Deactivate();
    pMarvin.Deactivate();
}

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


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

void EnterMeadows_3_1800()
{
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_3_1800"));
	
}

void EnterMeadows_3_1900()
{
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_3_1900"));
	pArrow1.SetVisible(true);
    ChangeSkinAnimation("Arrow1", "Data/GUI/AnimEntities/Anim/A_TutoArrowDown.ahsanimation");
    CFloat2 pos;
    CGameObject@ pAnimal = pTutorial.GetGameObject("Animal");
    pos = pAnimal.GetWorldPosition();
	pos.y -= 20;
    pArrow1.SetPosition(pos);
}

void UpdateMeadows_3_1900(float _fDelta)
{
    CFloat2 pos;
    CGameObject@ pAnimal = pTutorial.GetGameObject("Animal");
    pos = pAnimal.GetWorldPosition();
	pos.y -= 20;
    pArrow1.SetPosition(pos);
}

void EnterMeadows_3_2000()
{
	pArrow1.SetVisible(false);
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_3_2000"));
}

void EnterMeadows_3_2100()
{
	pText.SetText(pLocalizer.LocalizeText("MEADOWS_3_2100"));
	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@ pFoodTrough = pTutorial.GetGameObject("FoodTrough");
    pos = pFoodTrough.GetWorldPosition();
	pos.x += 32;
	pos.y += 20;
    pArrow1.SetPosition(pos);
	CGameObject@ pWaterTrough = pTutorial.GetGameObject("WaterTrough");
	pos = pWaterTrough.GetWorldPosition();
	pos.x += 36;
	pos.y += 8;
	pArrow2.SetPosition(pos);    
}

void EnterMeadows_3_2200()
{
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_3_2200"));
	CFloat2 pos;
    CGameObject@ pMedkit = pTutorial.GetGameObject("Medkit");
    pos = pMedkit.GetWorldPosition();
	pos.x += 32;
    pArrow1.SetPosition(pos);
	pArrow2.SetVisible(false);
}

void EnterMeadows_3_2300()
{
    pText.SetText(pLocalizer.LocalizeText("MEADOWS_3_2300"));
	pArrow1.SetVisible(true);
	CFloat2 pos;
	pos = pTutorial.GetGameObject("Flour").GetWorldPosition();
	pos.x += 55;
	pos.y -= 80;
	pArrow1.SetPosition(pos);
}

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

