/// <summary> /// 选中子物体下的粒子效果 /// </summary> public static void SelectChildParticleSystem(GameObject root) { ParticleSystem[] particleSystems = root.GetComponentsInChildren <ParticleSystem>(); if (particleSystems != null && particleSystems.Length > 0) { ObjectUtility.SelectionComponent(particleSystems); for (int iParticle = 0; iParticle < particleSystems.Length; iParticle++) { particleSystems[iParticle].Simulate(Constants.PARTICLE_SIMULATE_TIME_WHEN_EXPOTEING); } } }
public IEnumerator DoUpdate(Map map, bool isExporting) { InitAreaScenePath(); yield return(null); yield return(null); if (m_renders != null && m_renders.Length > 0) { for (int iRender = 0; iRender < m_renders.Length; iRender++) { m_renders[iRender].enabled = map.debugShowStarMap; if (iRender % 5 == 0) { yield return(null); } } } yield return(null); m_Map = map; if (m_Area == null) { List <Area> m_areaList = m_Map.GetAreaCache(); m_areaList.Clear(); Area[] areaArray = Object.FindObjectsOfType <Area>(); if (areaArray != null && areaArray.Length > 0) { for (int iArea = 0; iArea < areaArray.Length; iArea++) { if (areaArray[iArea].Uid == m_AreaUid) { m_areaList.Add(areaArray[iArea]); } } } if (m_areaList.Count == 1) { m_Area = m_areaList[0]; } //DebugUtility.Assert(m_areaList.Count <= 1, string.Format("Area错误,找到{0}个uid为{1}的Area",m_areaList.Count,m_AreaUid)); if (m_areaList.Count > 1) { Debug.LogError(string.Format("Area错误,找到{0}个uid为{1}的Area", m_areaList.Count, m_AreaUid)); } m_areaList.Clear(); yield return(null); } if (m_Area != null) { m_AreaUid = m_Area.Uid; m_AreaPosition = m_Area.transform.position; m_AreaRotation = m_Area.transform.rotation; if (isExporting) { ParticleSystem[] particleSystems = m_Area.GetComponentsInChildren <ParticleSystem>(); ObjectUtility.SelectionComponent(particleSystems); yield return(null); for (int iParticle = 0; iParticle < particleSystems.Length; iParticle++) { particleSystems[iParticle].Simulate(Constants.PARTICLE_SIMULATE_TIME_WHEN_EXPOTEING); } yield return(null); } } //m_AreaScenePath = string.Format("{0}/Area_{1}_{2}.unity", m_Map.GetOwnerAreaPath(), m_Map.Uid, m_AreaUid); m_areaSpawnObjName = gameObject.name; if (!m_areaSpawnObjName.Contains(m_AreaUid.ToString())) { m_areaSpawnObjName = string.Format("{0}_{1}", m_areaSpawnObjName, m_AreaUid); } gameObject.name = m_areaSpawnObjName; transform.localScale = m_Diameter * Vector3.one; //这个节点上不需要碰撞盒 Collider collider = GetComponent <Collider>(); if (collider != null) { collider.enabled = false; } if (m_Area != null) { IEnumerator areaEnumerator = m_Area.DoUpdate_Co(map, -1, isExporting, this); while (m_Area != null && m_Area.gameObject != null && areaEnumerator.MoveNext()) { if (!isExporting) { yield return(null); } } if (m_Area != null) { m_AABB = m_Area.GetAABB(); m_Diameter = m_Area.GetDiameter(); VoxelGrid = m_Area.VoxelGrid; } } }