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

        hpBarItemObject.Initialize(target);
        return(hpBarItemObject);
    }
Ejemplo n.º 2
0
    public HPBarItem ShowHP()
    {
        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);
    }