Ejemplo n.º 1
0
        IEnumerator DoUpdate()
        {
            while (true)
            {
                Transform areaTrans = transform.parent;
                while (areaTrans != null && areaTrans.GetComponent <Area>() == null)
                {
                    areaTrans = areaTrans.parent;
                }
                yield return(null);

                if (areaTrans != null)
                {
                    Area area = areaTrans.GetComponent <Area>();
                    if (area != null)
                    {
                        m_AreaId = area.Uid;

                        m_RelativeAreaPos   = area.transform.InverseTransformPoint(transform.position);
                        m_RelativeAreaRot   = Quaternion.Inverse(areaTrans.rotation) * transform.rotation;
                        m_RelativeAreaScale = ObjectUtility.CalculateLossyScale(transform, area.transform);
                        gameObject.name     = string.Format("{0}_Recast区域", areaTrans.name);
                    }
                }

                yield return(null);
            }
        }
Ejemplo n.º 2
0
        public void FillUnitInfo(ref SceneUnitInfo unitInfo, Area area, Quaternion areaInverseRotation)
        {
            unitInfo.LocalPosition = area.transform.InverseTransformPoint(transform.position);
            unitInfo.LocalRotation = areaInverseRotation * transform.rotation;
            unitInfo.LocalScale    = ObjectUtility.CalculateLossyScale(transform, area.transform);

            unitInfo._AABB     = m_AABB;
            unitInfo._Diameter = MathUtility.CaculateLongestSide(m_AABB);
        }
Ejemplo n.º 3
0
        public IEnumerator DoUpdate()
        {
            Transform areaTrans = transform.parent;

            while (areaTrans != null && areaTrans.GetComponent <Area>() == null)
            {
                areaTrans = areaTrans.parent;
            }
            Area area = areaTrans.GetComponent <Area>();

            if (area != null)
            {
                m_AreaId = area.Uid;

                m_RelativeAreaPos   = area.transform.InverseTransformPoint(transform.position);
                m_RelativeAreaRot   = Quaternion.Inverse(areaTrans.rotation) * transform.rotation;
                m_RelativeAreaScale = ObjectUtility.CalculateLossyScale(transform, area.transform);
                gameObject.name     = string.Format("{0}_寻宝节点", areaTrans.name);
            }

            m_SemaphorMarkCache.Clear();
            SemaphoreMark[] m_SemaphorMarks = GetComponentsInChildren <SemaphoreMark>();
            if (m_SemaphorMarks != null && m_SemaphorMarks.Length > 0)
            {
                m_SemaphorMarkCache.AddRange(m_SemaphorMarks);
                for (int iSeam = 0; iSeam < m_SemaphorMarkCache.Count; iSeam++)
                {
                    SemaphoreMark mark = m_SemaphorMarks[iSeam];
                    if (mark != null && mark.gameObject != null)
                    {
                        mark.DoUpdate();
                    }
                    yield return(null);
                }
            }
            yield return(null);
        }