Пример #1
0
        private UBlood GetBlood(BloodStyleType type, ref BloodCanvasNode canvNode)
        {
            UBlood ub = null;

            if (!bPreWarmBlood)
            {
                if (!AllocBloodPos(type, ref canvNode))
                {
                    return(null);
                }
                ub = InstanceUBlood(type, canvNode);
                return(ub);
            }
            if (!m_CacheBloodMap.ContainsKey(type))
            {
                if (!AllocBloodPos(type, ref canvNode))
                {
                    return(null);
                }
                ub = InstanceUBlood(type, canvNode);
                return(ub);
            }
            else
            {
                if (!m_CacheBloodMap.ContainsKey(type))
                {
                    if (!AllocBloodPos(type, ref canvNode))
                    {
                        return(null);
                    }
                    ub = InstanceUBlood(type, canvNode);
                    return(ub);
                }
                Queue <UBlood> m_CacheList = m_CacheBloodMap[type];
                if (m_CacheList.Count > 0)
                {
                    ub       = m_CacheList.Dequeue();
                    canvNode = ub.CanvasNode;
                    ub.RefreshTexture();
                }
                else
                {
                    if (!AllocBloodPos(type, ref canvNode))
                    {
                        return(null);
                    }
                    ub = InstanceUBlood(type, canvNode);
                }
            }
            return(ub);
        }