コード例 #1
0
        public static HPBarItemObject Create(object target)
        {
            HPBarItemObject hpBarItemObject = ReferencePool.Acquire <HPBarItemObject>();

            hpBarItemObject.Initialize(target);
            return(hpBarItemObject);
        }
コード例 #2
0
ファイル: HPBarComponent.cs プロジェクト: DearestAKL/Monopoly
        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);
        }