예제 #1
0
 private void PutHUDInPool(FightingHeadBarHud hud)
 {
     hud.mDMono.transform.SetParent(m_Container);
     hud.mDMono.gameObject.SetActive(false);
     hudsPool.Push(hud);
     hud.recycleCallback = null;
 }
예제 #2
0
        private FightingHeadBarHud CreateHUD()
        {
            if (HUDTemplate == null)
            {
                EB.Debug.LogError("HUDTemplate is null");
                return(null);
            }

            FightingHeadBarHud hud = Object.Instantiate <GameObject>(HUDTemplate).GetMonoILRComponent <FightingHeadBarHud>();

            hud.mDMono.transform.SetParent(m_Container);
            hud.mDMono.transform.localScale = new Vector3(1f, 1f, 0f);
            return(hud);
        }
예제 #3
0
        private FightingHeadBarHud GetHUDFromPool()
        {
            FightingHeadBarHud hud = null;

            if (hudsPool.Count > 0)
            {
                hud = hudsPool.Pop();
                hud.mDMono.gameObject.SetActive(true);
            }
            else
            {
                EB.Debug.Log("HUD pool length too small. GetHUDFromPool() called but pool is empty. New HUD instance created");
                hud = CreateHUD();
            }

            hud.recycleCallback = delegate()
            {
                PutHUDInPool(hud);
            };

            return(hud);
        }