//缓存血条 private void CacheBlood(UBlood ub) { if (null == ub) { return; } if (!m_CacheBloodMap.ContainsKey(ub.BloodType)) { DestroyBlood(ub); return; } if (ub.ISHero) { return; } if (m_BloodMap.ContainsKey(ub.ID)) { ub.SetEnable(false); ub.ChangeBloodColor(false); ub.ChangeParent(CacheBloodRoot.transform); Queue <UBlood> m_list = m_CacheBloodMap[ub.BloodType]; m_list.Enqueue(ub); m_BloodMap.Remove(ub.ID); } else { DestroyBlood(ub); } }
//预热血条 public void PreWarmBlood() { if (bPreWarmBlood) { return; } bPreWarmBlood = true; for (int i = 0; i < (int)BloodStyleType.Boss; i++) { BloodStyleType eType = (BloodStyleType)i; if (!m_CacheBloodMap.ContainsKey(eType)) { m_CacheBloodMap.Add(eType, new Queue <UBlood>()); } Queue <UBlood> BloodList = m_CacheBloodMap[eType]; BloodList.Clear(); for (int n = 0; n < CacheCountArry[i]; n++) { BloodCanvasNode canvNode = new BloodCanvasNode(); if (!AllocBloodPos(eType, ref canvNode)) { continue; } UBlood ub = InstanceUBlood(eType, canvNode); if (null != ub) { ub.Init(null, 0, eType, canvNode); ub.ChangeParent(CacheBloodRoot.transform); ub.SetEnable(false); BloodList.Enqueue(ub); } } } if (EntityFactory.MainHero != null) { bossBloodTarget = EntityFactory.MainHero.transform; } }
public void UpdateBlood(EntityView view) { int entityID = -1; if (EntityView.isNullOrEmpty(view)) { return; } entityID = view.ID; if (m_BloodMap.ContainsKey(entityID)) { UBlood ub = m_BloodMap[entityID]; ub.Entity = view; ub.ChangeParent(view.transform); if (view.Property != null) { ub.SetCampType(view.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_CAMP)); } } }