/// <summary> /// 缓存血条 /// </summary> /// <param name="b"></param> static void CacheBlood(GfxBlood b) { if (!OptimitzedControlPlane.Instance.EnityCreateOptimize || null == b) { return; } ENTITY_TYPE entity_Type = b.bloodType; if (!m_CacheBlood.ContainsKey(entity_Type)) { Debug.LogError("缓存" + entity_Type + "类型血条失败,请在InitCache中添加!"); return; } int id = b.ID; //不存主角 if (id == EntityFactory.MainHeroID) { return; } if (m_BloodMap.ContainsKey(id)) { b.SetEnable(false); b.SetBloodColor(false); b.ChangeParent(CacheBloodRoot.transform); Queue <GfxBlood> m_list = m_CacheBlood[entity_Type]; m_list.Enqueue(b); m_BloodMap.Remove(id); } }
public static void PreWarmBlood() { if (bPreWarmBlood) { return; } bPreWarmBlood = true; Queue <GfxBlood> MonsterList = m_CacheBlood[ENTITY_TYPE.TYPE_MONSTER]; for (int i = 0; i < MonsterCacheCout; i++) { MovieNode moveNode = new MovieNode(); if (!AllocBloodPos(ENTITY_TYPE.TYPE_MONSTER, ref moveNode)) { //Debug.LogWarning("Movie空间不足,最多只能容纳:" + MaxColCount * MaxRowCount + "个血条!!"); continue; } GfxBlood gb = CreateBloodInstance(MonsterBloodAS3RefrenceName); gb.Init(-1, CacheBloodRoot, -1, ENTITY_TYPE.TYPE_MONSTER); gb.CreateBillBorad(); gb.ChangeParent(CacheBloodRoot.transform); gb.SetEnable(false); gb.ChangeMovieNode(moveNode); MonsterList.Enqueue(gb); } Queue <GfxBlood> PlayerList = m_CacheBlood[ENTITY_TYPE.TYPE_PLAYER_ROLE]; for (int i = 0; i < PlayerCacheCout; i++) { MovieNode moveNode = new MovieNode(); if (!AllocBloodPos(ENTITY_TYPE.TYPE_PLAYER_ROLE, ref moveNode)) { //Debug.LogWarning("Movie空间不足,最多只能容纳:" + MaxColCount * MaxRowCount + "个血条!!"); continue; } GfxBlood gb = CreateBloodInstance(PlayerBloodAS3RefrenceName); gb.Init(-1, CacheBloodRoot, -1, ENTITY_TYPE.TYPE_PLAYER_ROLE); gb.SetMaxValue(100); gb.SetCurValue(100); gb.CreateBillBorad(); gb.ChangeParent(CacheBloodRoot.transform); gb.SetEnable(false); gb.ChangeMovieNode(moveNode); PlayerList.Enqueue(gb); } Queue <GfxBlood> TankList = m_CacheBlood[ENTITY_TYPE.TYPE_TANK]; for (int i = 0; i < TankCacheCout; i++) { MovieNode moveNode = new MovieNode(); if (!AllocBloodPos(ENTITY_TYPE.TYPE_TANK, ref moveNode)) { //Debug.LogWarning("Movie空间不足,最多只能容纳:" + MaxColCount * MaxRowCount + "个血条!!"); continue; } GfxBlood gb = CreateBloodInstance(BuildingsBloodAS3RefrenceName); gb.Init(-1, CacheBloodRoot, -1, ENTITY_TYPE.TYPE_TANK); gb.SetMaxValue(100); gb.SetCurValue(100); gb.CreateBillBorad(); gb.ChangeParent(CacheBloodRoot.transform); gb.SetEnable(false); gb.ChangeMovieNode(moveNode); TankList.Enqueue(gb); } }