Exemplo n.º 1
0
    void Awake()
    {
        instance = this;
        Cache();



//美术测试模式下自动设置跟随者和镜头
#if ART_DEBUG
        //跟随者
        if (m_prefab != null && m_ca != null)
        {
            //if (UnityEditor.PrefabUtility.GetPrefabType(m_prefab) == UnityEditor.PrefabType.Prefab)
            if (m_prefab.transform.parent == null && GameObject.Find(m_prefab.name) == null)//如果是预制体,那么创建
            {
                m_prefab = (GameObject)Object.Instantiate(m_prefab);
            }

            Transform t = m_prefab.transform;
            SetFollow(t);
        }
        else
        {
            Debuger.LogError("CameraMgr;相机找不到跟随对象,是否给相机设置跟随对象");
        }

        //设置初始镜头
        GameObject go = GameObject.Find("CameraTriggerManage");
        if (go == null) //没有场景相机触发管理器就用
        {
            if (m_ca != null)
            {
                SetFollowPos(PosUtil.CaleByCamera(m_ca));
            }
            Set(m_curCameraInfo);
        }
        else
        {
            CameraTriggerMgr mgr = go.GetComponent <CameraTriggerMgr>();
            if (m_ca != null)
            {
                SetFollowPos(mgr.CurGroup.m_bornPos);
            }
            mgr.CurGroup.SetGroupActive(true);
        }
#endif
    }