예제 #1
0
 public override void Init()
 {
     base.Init();
     cutCount         = cutList.Count;
     isEnd            = false;
     currentCut       = null;
     currentCutNumber = 0;
 }
예제 #2
0
    public IEnumerator ProcessCutScene()
    {
        Debug.Log("StartCutscene");
        canvasObject.SetActive(true);
        UIBase tempUI;

        UIManager.Instance.uiDicitonary.TryGetValue(uiType, out tempUI);
        if (tempUI != this)
        {
            UIManager.Instance.RemoveToDictionary(tempUI);
            UIManager.Instance.AddToDictionary(this);
        }


        if (cutCount == 0) //갯수가 0이면
        {
            Debug.LogWarning("UICutScene : 이상하다...재생시킬 컷이 없어! 추가를 깜빡한거 아니야?");
            yield break;
        }
        isNext = false;
        isEnd  = false;

        currentCut       = null;
        currentCutNumber = -1;

        while (currentCutNumber < cutCount - 1) //작을 때 까지 반복
        {
            isNext            = false;
            currentCutNumber += 1;
            Debug.Log("현재 컷 넘버 : " + currentCutNumber);

            currentCut = cutList[currentCutNumber];

            currentCut.SetActive(true);


            currentCut.Open();

            while (!currentCut.isOn)
            {
                if (isNext)
                {
                    currentCut.isSkip = true;
                    break;
                }
                yield return(YieldInstructionCache.WaitForEndOfFrame);
            }

            float nextTimer = 0f;
            if (currentCutNumber != cutCount - 1)
            {
                if (isNext == false)
                {
                    while (nextTimer < currentCut.waitTime)
                    {
                        if (isNext)
                        {
                            isNext = false;
                            break;
                        }
                        nextTimer += Time.unscaledDeltaTime;

                        yield return(YieldInstructionCache.WaitForEndOfFrame);
                    }
                }
            }

            if (currentCut.useAnimation == true)
            {
                currentCut.anim.enabled = false;
            }
        }

        yield return(null);



        if (isLastFade == true)
        {
            isNext = false;


            while (isNext == false)
            {
                yield return(YieldInstructionCache.WaitForEndOfFrame);
            }


            frontBlackCut.SetActive(true);
            frontBlackCut.Open();

            while (!frontBlackCut.isOn)
            {
                yield return(YieldInstructionCache.WaitForEndOfFrame);
            }

            for (int i = 0; i < cutCount; i++)
            {
                cutList[i].SetActive(false);
            }
        }


        isEnd  = true;
        isNext = false;
        //        StartCloseCutScene();
    }