Exemple #1
0
        public IEnumerator _moveToTarget(int resID)
        {
            //等待场景加载完才播boss 动画
            while (CoreEntry.bLoadSceneComplete != true)
            {
                LogMgr.UnityLog("_moveToTarget 等待场景加载完才播boss 动画 ");
                yield return(new WaitForSeconds(0.1f));
            }


            ActorObj actorBase = CoreEntry.gActorMgr.GetActorByConfigID(resID);

            if (actorBase == null)
            {
                LogMgr.UnityError("找不到怪物ID:" + resID);
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_TASK_Camera_end, null);
                yield break;
            }
            IActorState state = actorBase.GetActorState(ACTOR_STATE.AS_ENTER);

            if (state != null)
            {
                //state.Reset();
                try
                {
                    EnterState eState = state as EnterState;
                    eState.EndEnterStateFromCamera(actorBase);
                }
                catch (Exception e)
                {
                    LogMgr.UnityError(e.ToString());  //状态没有初始化
                }
            }


            CameraFollow cameraFollow = null;

            if (null != MainCamera)
            {
                cameraFollow = MainCamera.GetComponent <CameraFollow>();
            }
            if (cameraFollow == null)
            {
                CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_TASK_Camera_end, null);
                yield break;
            }

            lastDistance = cameraFollow.m_distance;
            lastHeight   = cameraFollow.m_height;

            CoreEntry.gGameMgr.pauseGame();

            yield return(new WaitForSeconds(0.6f));


            //TweenAttr2.SetAttr fnSetHeight = new TweenAttr2.SetAttr(cameraFollow.SetHeight);
            //TweenAttr.SetAttr fnSetDistance = new TweenAttr.SetAttr(cameraFollow.SetDistance);


            float distance = cameraFollow.getDistance(m_bossObj.transform);

            if (distance < 10)
            {
                cameraSpeed = 4;
            }
            else if (distance < 20)
            {
                cameraSpeed = 6;
            }
            LogMgr.UnityLog("镜头速度调整为:" + cameraSpeed);

            yield return(new WaitForSeconds(1.9f));

            //通知剧情, 镜头已经移动到目标
            CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_TASK_Camera_Focus, null);
        }