Esempio n. 1
0
        public static HPBarItemObject Create(object target)
        {
            HPBarItemObject hpBarItemObject = ReferencePool.Acquire <HPBarItemObject>();

            hpBarItemObject.Initialize(target);
            return(hpBarItemObject);
        }
Esempio n. 2
0
        private HPBarItem CreateHPBarItem(Entity entity)
        {
            HPBarItem       hpBarItem       = null;
            HPBarItemObject hpBarItemObject = m_HPBarItemObjectPool.Spawn();

            if (hpBarItemObject != null)
            {
                hpBarItem = (HPBarItem)hpBarItemObject.Target;
            }
            else
            {
                hpBarItem = Instantiate(m_HPBarItemTemplate);
                Transform transform = hpBarItem.GetComponent <Transform>();
                transform.SetParent(m_HPBarInstanceRoot);
                transform.localScale = Vector3.one;
                m_HPBarItemObjectPool.Register(HPBarItemObject.Create(hpBarItem), true);
            }

            return(hpBarItem);
        }