예제 #1
0
        public IEnumerator DoUpdate_Co(Map map, int indexInMap, bool isExporting, AreaSpawner areaSpawner = null)
        {
            m_Leap         = GetComponentInChildren <MapLeap>();
            m_TreasureRoot = GetComponentInChildren <TreasureRootMark>();
            if (m_TreasureRoot != null)
            {
                IEnumerator treasureEnumerator = m_TreasureRoot.DoUpdate();
                if (treasureEnumerator != null)
                {
                    while (treasureEnumerator.MoveNext())
                    {
                        yield return(null);
                    }
                }
            }
            yield return(null);

            map.LoadExtenInfo(this);
            m_MineralRoot = GetComponentInChildren <MineralRootMark>();
            if (m_MineralRoot != null)
            {
                IEnumerator mineralEnumerator = m_MineralRoot.DoUpdate();
                if (mineralEnumerator != null)
                {
                    while (mineralEnumerator.MoveNext())
                    {
                        yield return(null);
                    }
                }
            }
            yield return(null);

            if (m_Leap != null)
            {
                m_Leap.DoUpdate(areaSpawner.m_AreaUid);
            }
            m_OwnerMap           = map;
            m_OwnerAreaSpawner   = areaSpawner;
            transform.localScale = Vector3.one;            // 美术说Area不会有缩放
            if (m_OwnerAreaSpawner != null)
            {
                gameObject.name = m_OwnerAreaSpawner.GetAreaSpawnObjName();
            }
            Bounds areaAABB = new Bounds();

            MapEditorUtility.CaculateAABB(transform, ref areaAABB, isExporting);
            m_AABB     = areaAABB;
            m_Diameter = MathUtility.CaculateDiagonal(m_AABB);
            if (VoxelGrid != null)
            {
                VoxelGrid.DoUpdate(m_AABB);
            }

            _Debug.DoUpdate(this);
        }
예제 #2
0
        public override void OnInspectorGUI()
        {
            EditorGUI.indentLevel = 0;
            m_LeapObjsFold        = EditorGUILayout.Foldout(m_LeapObjsFold, "跃迁点列表");
            if (m_LeapObjsFold)
            {
                EditorGUI.indentLevel = 1;
                MapLeap[] leapObjs = m_Target.m_Leaps;
                if (leapObjs != null && leapObjs.Length > 0)
                {
                    for (int iLeap = 0; iLeap < leapObjs.Length; iLeap++)
                    {
                        MapLeap mapLeap = leapObjs[iLeap];
                        if (GUILayout.Button(mapLeap.gameObject.name))
                        {
                            Selection.activeObject = mapLeap;
                        }
                    }
                }
            }

            EditorGUI.indentLevel = 0;
            m_SelectLeapFold      = EditorGUILayout.Foldout(m_SelectLeapFold, "选择跃迁点");
            if (m_SelectLeapFold)
            {
                EditorGUI.indentLevel = 1;
                MapLeap[] leapObjs = m_Target.m_Leaps;
                if (leapObjs != null && leapObjs.Length > 0)
                {
                    for (int iLeap = 0; iLeap < leapObjs.Length; iLeap++)
                    {
                        MapLeap mapLeap = leapObjs[iLeap];
                        m_Toggles[iLeap] = EditorGUILayout.Toggle(mapLeap.m_LeapName, m_Toggles[iLeap]);
                        if (m_Toggles[iLeap])
                        {
                            for (int iToggle = 0; iToggle < m_Toggles.Count; iToggle++)
                            {
                                m_Toggles[iToggle] = iToggle == iLeap ? true : false;
                            }
                        }
                    }
                }
            }
            EditorGUI.indentLevel = 0;
            if (GUILayout.Button("跃迁"))
            {
                Leap();
            }
            if (GUILayout.Button("刷新"))
            {
                OnEnable();
            }
        }