예제 #1
0
        //缓存血条
        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);
            }
        }
예제 #2
0
        //预热血条
        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;
            }
        }
예제 #3
0
        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));
                }
            }
        }