public void DoNameAniAlphaSound()
    {
        //IsAlphaAction = true;
        SoundManager.instance.PlayBgmSound("BGM_Boss");

        GetComponent <UIPanel> ().alpha = 1.0f;

        float delay = 0.5f;

        if (GameObject.Find("CutSceneCameraMover") != null)
        {
            CutSceneSeqHelper csh = GameObject.Find("CutSceneCameraMover").GetComponent <CutSceneSeqHelper> ();
            if (csh != null)
            {
                delay = csh.name_maintain_time;
            }
        }

        Anim.Play("BossNameAnimation");
        float length = Anim.GetClip("BossNameAnimation").length;

        TempCoroutine.instance.FrameDelay(length + delay, delegate() {
            if (Alpha != null)
            {
                Alpha.ResetToBeginning();
                Alpha.PlayForward();
            }
        });
        SoundManager.instance.PlaySfxSound(eUISfx.UI_boss_revial, false);
    }
    // only for cutscene.
    public void startSlowEffect(float _delay)
    {
        if (CutSceneMgr.isBossCutSceneProgress == false)
        {
            return;
        }

        Time.timeScale = 0.1f;

        if (GameObject.Find("CutSceneCameraMover") != null)
        {
            CutSceneSeqHelper cst = GameObject.Find("CutSceneCameraMover").GetComponent <CutSceneSeqHelper> ();
            if (cst != null)
            {
                Time.timeScale = cst.time_slowEffectSped;
            }
        }

        TempCoroutine.instance.FrameDelay(_delay, () => {
            Time.timeScale = GameDefine.DefaultTimeScale;
        });
    }
Exemple #3
0
    static IEnumerator DoBossCutScene2()
    {
        isTestScene = false;
        if (GameObject.Find("CutSceneTestManager"))
        {
            isTestScene = true;
        }

        isBossCutSceneProgress = true;

        yield return(new WaitForSeconds(0.1f));

        if (cameraMover == null)
        {
            if (GameObject.Find("CutSceneCameraMover") != null)
            {
                cameraMover = GameObject.Find("CutSceneCameraMover").GetComponent <hoMove>();
            }

            //cameraMover = new GameObject("CameraMover");
            //cameraMover.AddComponent<hoMove>();
        }

        UIHelper.SetMainCameraDepth(100);

        initStartCamAndShakeCam();

        //startCamObj.transform.parent = cameraMover.gameObject.transform;
        startCamObj.transform.parent = cameraMover.cameraContainer;

        Unit targetUnit = CutSceneEventDic [0].GetComponent <Unit> ();

        GameObject targetObject = new GameObject("lookAtTarget");

        targetObject.transform.position = targetUnit.transform.position + Vector3.up * 1.23f;

        cameraMover.bLookAtTarget = true;
        //if (cameraMover.transformForLookAtTarger == null) {
        //cameraMover.transformForLookAtTarger = targetUnit.transform;
        cameraMover.transformForLookAtTarger = targetObject.transform;
        //}


        CutSceneSeqHelper csHelper = GameObject.Find("CutSceneCameraMover").GetComponent <CutSceneSeqHelper> ();

        GameObject      abp       = null;
        AppearBossPanel bossPanel = null;

        bool isPanelInited = false;
        // fot test loop

        bool bLoop = true;

        while (bLoop)
        {
            isBossCutSceneProgress = true;


            // set first pos
            //startCamObj.transform.localPosition = Vector3.zero;
            //startCamObj.transform.localRotation = Quaternion.identity;
            //startCamObj.transform.localPosition = startRootObj.transform.position;
            //startCamObj.transform.localRotation = startRootObj.transform.rotation;

            //UIHelper.SetMainCameraActive (false);

            //Debug.Break();

            UIHelper.SetMainCameraDepth(100);

            yield return(new WaitForSeconds(csHelper.start_delay));

            G_GameInfo.GameInfo.FocusingCam.ChangeParent(startCamObj.transform);
            G_GameInfo.GameInfo.FocusingCam.StartEffect(0, true);
            G_GameInfo.GameInfo.FocusingCam.AddObject(targetUnit.gameObject);
            cutSceneCamShaker.cameras.Add(G_GameInfo.GameInfo.FocusingCam.GetComponent <Camera>());

            // camera move to first path's position.
            cameraMover.transform.position = cameraMover.pathContainer.transform.FindChild("WaypointStart").transform.position;
            cameraMover.transform.LookAt(targetUnit.transform.position);
            cameraMover.cameraContainerLookat();

            startCamObj.transform.localPosition = Vector3.zero;
            startCamObj.transform.localRotation = Quaternion.identity;


            cameraMover.StartMove();

            // camera change
            UIHelper.SetMainCameraActive(false);
            UIHelper.SetMainCameraDepth(0);

            // wait until cameraMover finish
//			while(cameraMover.bReachedTweenMove==false){
//				yield return null;
//			}

            TempCoroutine.instance.FrameDelay(csHelper.delay_for_name_ani, delegate() {
                if (isPanelInited)
                {
                    bossPanel.DoNameAniAlphaSound();
                }
                else
                {
                    UIMgr.OpenAppearBoss();
                    abp           = GameObject.Find("UIPanel/AppearBossPanel");
                    bossPanel     = abp.GetComponent <AppearBossPanel> ();
                    isPanelInited = true;
                }
            });

            TempCoroutine.instance.FrameDelay(csHelper.delay_for_boss_ani, delegate() {
                // boss npc animation
                InGameHUDPanel hudpanel = UIMgr.GetUI("UIPanel/InGameHUDPanel").GetComponent <InGameHUDPanel> ();
                if (hudpanel != null)
                {
                    hudpanel.BossUnit.ChangeState(UnitState.Event);
                }
            });

            // boss npc 의 애니메이션에서 stopBossCutScene()이 호출되어  coroutine이 종료되므로 실제 이 yield를 기다려서 종료하지 않고 loop도 돌지 않는다. . only for test.
            //yield return new WaitForSeconds (csHelper.sequence_total_time);

            // for safe. prevent loop dead lock.
            //G_GameInfo.GameInfo.StartCoroutine("forceFinishCutScene");
            forceFinishCutSceneCoroutine = forceFinishCutScene();
            G_GameInfo.GameInfo.StartCoroutine(forceFinishCutSceneCoroutine);

            while (isBossCutSceneProgress)
            {
                yield return(null);
            }

            bLoop = false;
            if (isTestScene)
            {
                // delay for repeatly loop test
                bLoop = true;
                yield return(new WaitForSeconds(1.0f));
            }
        }

        isBossCutSceneProgress = false;

        yield return(null);
    }