Exemple #1
0
 public void DoUpdate(Area owner)
 {
     Diameter = MathUtility.CaculateDiagonal(owner.GetAABB());
     if (VoxelDebug != null && owner != null)
     {
         VoxelDebug.DoUpdate(owner.VoxelGrid, owner.gameObject);
     }
 }
Exemple #2
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);
        }