Beispiel #1
0
    private void AddNewStatusEffectDisplay(StatusEffectBase statusEffect)
    {
        StatusEffectDisplay statusEffectDisplay = Instantiate(statusEffectDisplayPrefab, transform).GetComponent <StatusEffectDisplay>();

        statusEffectDisplay.InitializeDisplay(statusEffect);

        activeStatusEffectsDisplays.Add(statusEffectDisplay);
    }
        /// <summary>
        /// Adds a status effect display to the status effect holder
        /// </summary>
        /// <param name="se"></param>
        public void AddStatusEffectDisplay(StatusEffect se)
        {
            GameObject          newSED       = Instantiate(SEDisplayPrefab);
            StatusEffectDisplay SEDComponent = newSED.GetComponent <StatusEffectDisplay>();

            SEDComponent.Init(se);
            SEDComponent.b.interactable = true;

            SEDComponent.transform.SetParent(SEHolder.transform, false);
        }
Beispiel #3
0
    StatusEffectDisplay DequeueDisplay()
    {
        if (reusableDisplays.Count > 0)
        {
            StatusEffectDisplay entry = reusableDisplays.Dequeue();
            Debug.Log($"Reusing entry for { entry.name }.");
            entry.gameObject.SetActive(true);
            return(entry);
        }
        // Debug.Log($"Creating new entry.");
        var instance = Instantiate(effectPrefab);

        instance.gameObject.transform.SetParent(transform, false);
        return(instance);
    }
Beispiel #4
0
 void EnqueueEntry(StatusEffectDisplay entry)
 {
     currentDisplays.Remove(entry);
     reusableDisplays.Enqueue(entry);
     entry.gameObject.SetActive(false);
 }