//------------------------------------------------ Patchs Functions ---------------------------------------------------
void ChangePatchMaterial(CString _strPatchName, CString _strMaterialFileName)
{
    CGamePatch@ pGamePatch = cast<CGamePatch>(pTutorial.GetGameObject(_strPatchName));
    CPatch@ pPatch = pGamePatch.GetPatch();
    CFileName materialName;
    materialName.Set(_strMaterialFileName);
    pPatch.ChangeMaterial(LoadMaterial(materialName));
}

//------------------------------------------------ Skins Functions ---------------------------------------------------
void ChangeSkinAnimation(CString _strSkinName, CString _strAnimationFileName)
{
    CGameSkin@ pGameSkin = cast<CGameSkin>(pTutorial.GetGameObject(_strSkinName));
    ChangeSkinAnimation(pGameSkin, _strAnimationFileName);
}

void ChangeSkinAnimation(CGameSkin@ _pGameSkin, CString _strAnimationFileName)
{
    CSkin@ pSkin = _pGameSkin.GetSkin();
    CFileName animationName;
    animationName.Set(_strAnimationFileName);
    pSkin.SetAnimation(LoadAnimation(animationName), true);
}

//------------------------------------------------ Arrows Functions ---------------------------------------------------
void PointArrowTo(CGameSkin@ _pArrow,  CString _strAnimationFileName, CString _strGameObjectName, float _fXOffset, float _fYOffset)
{
    CGameObject@ pGameObject = pTutorial.GetGameObject(_strGameObjectName);
    CFloat2 pos = pGameObject.GetWorldPosition();
    pos.x += _fXOffset;
    pos.y += _fYOffset;
    _pArrow.SetWorldPosition(pos);
    ChangeSkinAnimation(_pArrow, _strAnimationFileName);
    _pArrow.SetVisible(true);
}

//------------------------------------------------ RTC 3 2 1 GO! Functions ---------------------------------------------------
bool bRTC321GOFinished = false;
CGameRtc@ pRTC321GO;
CRtcEventHandler rtc321GOEnded;
void EnterRTC321GO()
{
    if( @pTutorial.GetGameObject("Dialog") != null )
    {
        pTutorial.GetGameObject("Dialog").SetVisible(false);
    }
    if( @pText != null )
    {
        pText.SetVisible(false);
    }
    bRTC321GOFinished = false;
    rtc321GOEnded.SetCallback(null, OnRTC321GOEnded);
    @pRTC321GO = cast<CGameRtc>(pTutorial.GetGameObject("RTC321GO"));
    pRTC321GO.SetVisible(true);
    pRTC321GO.GetRtc().RegisterToEventRtcEnded(rtc321GOEnded);
    pRTC321GO.GetRtc().Play();
}

void UpdateRTC321GO(float _fDelta)
{
    if( bRTC321GOFinished )
    {
        pTutorial.GoToNextScene();
    }
}

void OnRTC321GOEnded(CRtc@ _pSender)
{
    bRTC321GOFinished = true;
}

void ExitRTC321GO()
{
    pRTC321GO.SetVisible(false);
    pRTC321GO.GetRtc().UnregisterFromEventRtcEnded(rtc321GOEnded);
}