Beispiel #1
0
        public IEnumerator OnUpdate(GamingMap gamingMap)
        {
            m_GamingMap = gamingMap;
            if (m_LeapList == null)
            {
                m_LeapList = new List <Leap>();
            }
            m_LeapList.Clear();
            Leap[] leaps = GetComponentsInChildren <Leap>(true);
            if (leaps != null && leaps.Length > 0)
            {
                for (int iLeap = 0; iLeap < leaps.Length; iLeap++)
                {
                    m_LeapList.Add(leaps[iLeap]);
                }
            }
            yield return(null);

            //为了确定有没有遗漏没有的跃迁点
            if (m_GamingMap != null)
            {
                List <GamingMapArea> areaList = m_GamingMap.m_GamingAreaList;
                if (areaList != null && areaList.Count > 0)
                {
                    for (int iArea = 0; iArea < areaList.Count; iArea++)
                    {
                        GamingMapArea area = areaList[iArea];
                        if (area != null)
                        {
                            LeapRoot leapRoot = area.m_LeapRoot;
                            if (leapRoot != null)
                            {
                                Leap leap = GetLeap(leapRoot.m_LeapId);
                                if (leap == null)
                                {
                                    leap = CreateLeap(leapRoot);
                                    m_LeapList.Add(leap);
                                }
                            }
                        }
                    }
                }
            }
            yield return(null);

            //因为只能由一个区域在线
            GamingMapArea showArea = null;

            if (m_GamingMap.m_GamingAreaList != null && m_GamingMap.m_GamingAreaList.Count > 0)
            {
                showArea = m_GamingMap.m_GamingAreaList[0];
            }
            //刷新Leap
            if (m_LeapList != null && m_LeapList.Count > 0)
            {
                for (int iLeap = 0; iLeap < m_LeapList.Count; iLeap++)
                {
                    Leap leap = m_LeapList[iLeap];

                    IEnumerator leapUpdateEnum = leap.OnUpdate(this, GetArea(leap.m_LeapId), showArea);
                    while (leapUpdateEnum != null && leapUpdateEnum.MoveNext())
                    {
                        yield return(null);
                    }
                }
            }
            yield return(null);
        }