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); } }
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); }
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); }