bool bRtcFinished = false;
CRtcEventHandler rtcFinished;
CRtc@ pRtc;
uint64 musicID;

//------------------------------------------------ Init/Release ---------------------------------------------------
void InitTutorial()
{
    rtcFinished.SetCallback(null, @RtcFinished);
    CGameRtc@ pGameRtc = cast<CGameRtc>(GetGame().GetCurrentLevel().GetTutorial().GetGameObject("RTC"));
    @pRtc = pGameRtc.GetRtc();
    pRtc.RegisterToEventRtcEnded(rtcFinished);
	musicID = PlayMusic("Data/Musics/Upgrade.ogg", true);
}

void ReleaseTutorial()
{
    pRtc.UnregisterFromEventRtcEnded(rtcFinished);
	StopMusic(musicID, 0.5f);
}

//------------------------------------------------ Script Functions ---------------------------------------------------
void UpdateWaitRTCToFinish(float _fDelta)
{
    if( bRtcFinished )
    {
        GetGame().GetCurrentLevel().GetTutorial().Skip();
    }
}

void RtcFinished(CRtc@ _pSender)
{
    _pSender.UnregisterFromEventRtcEnded(rtcFinished);
    bRtcFinished = true;
}