Ejemplo n.º 1
0
 void Cache()
 {
     if (m_cache)
     {
         return;
     }
     m_cache  = true;
     instance = this;
     Reset();
     //如果没有默认的,那么第一个就是默认的
     if (m_cur == null && m_groups.Count > 0)
     {
         m_cur = m_groups[0];
     }
 }
Ejemplo n.º 2
0
    void DrawGroup()
    {
        CameraTriggerMgr mgr = CameraTriggerMgr.instance;


        mgr.CurGroup.gameObject.name = EditorGUILayout.TextField("镜头组名", mgr.CurGroup.gameObject.name);
        using (new AutoBeginHorizontal())
        {
            EditorGUILayout.PrefixLabel("出生点");
            mgr.CurGroup.m_bornPos = EditorGUILayout.Vector3Field(GUIContent.none, mgr.CurGroup.m_bornPos, GUILayout.Height(18));
            if (GUILayout.Button("同步到跟随者", GUILayout.Width(100)))
            {
                mgr.CurGroup.m_bornPos = CameraMgr.instance.GetFollowPos();
            }
        }
    }
Ejemplo n.º 3
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
    }
Ejemplo n.º 4
0
    void DrawTriggers()
    {
        CameraTriggerMgr   mgr   = CameraTriggerMgr.instance;
        CameraTriggerGroup group = mgr.CurGroup;

        using (AutoBeginScrollView a = new AutoBeginScrollView(m_scroll, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false)))//, GUILayout.ExpandHeight(true)
        {
            m_scroll = a.Scroll;
            DrawCameraInfo(mgr.CurGroup.m_defaultInfo, "默认镜头", true, true);

            foreach (CameraTrigger t in group.Triggers)
            {
                if (DrawTrigger(t))
                {
                    group.RemoveTrigger(t);
                    return;
                }
            }
        }
    }
Ejemplo n.º 5
0
    void DrawToolBar()
    {
        using (new AutoBeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true)))
        {
            CameraTriggerMgr mgr        = CameraTriggerMgr.instance;
            string[]         groupNames = mgr.GroupNames;
            int idx    = System.Array.IndexOf(groupNames, mgr.CurGroup.name);
            int newIdx = EditorGUILayout.Popup(idx, groupNames, EditorStyles.toolbarPopup, GUILayout.Width(130));
            if (newIdx != idx)
            {
                mgr.CurGroup = mgr.GetGroupByName(groupNames[newIdx]);
            }

            if (GUILayout.Button("增加镜头组", EditorStyles.toolbarButton, GUILayout.Width(80)))
            {
                mgr.CurGroup = mgr.AddGroup();
            }

            if (GUILayout.Button("当前组增加镜头", EditorStyles.toolbarButton, GUILayout.Width(100)))
            {
                mgr.CurGroup.AddTrigger();
            }
        }
    }
Ejemplo n.º 6
0
 void OnDestroy()
 {
     instance = null;
 }