Exemplo n.º 1
0
        public void ShowHPBar(Entity entity, float fromHPRatio, float toHPRatio)
        {
            HPBarItem hpBarItem = GetActiveHPBarItem(entity);

            if (hpBarItem == null)
            {
                hpBarItem = CreateHPBarItem(entity);
                m_ActiveHPBarItems.Add(hpBarItem);
            }

            hpBarItem.Init(entity, fromHPRatio, toHPRatio);
        }
Exemplo n.º 2
0
        private HPBarItem CreateHPBarItem(Entity entity)
        {
            HPBarItem hpBarItem = null;

            if (m_HPBarItemTemplate != null)
            {
                hpBarItem = Instantiate(m_HPBarItemTemplate);
                Transform transform = hpBarItem.GetComponent <Transform>();
                transform.SetParent(m_HPBarRoot);
                transform.localScale       = Vector3.one;
                hpBarItem.gameObject.layer = m_HPBarRoot.gameObject.layer;
            }
            return(hpBarItem);
        }