Esempio n. 1
0
 private void Start()
 {
     canvas = GetComponent <Canvas>();
     bubble = transform.Find("Bubble").gameObject.AddComponent <SingleBubble>();
     bubble.Init();
     bubble.gameObject.SetActive(false);
     bubbles     = new List <SingleBubble>();
     bubblePools = new List <SingleBubble>();
 }
Esempio n. 2
0
 public void Recycle(SingleBubble bubble)
 {
     if (bubbles.Contains(bubble))
     {
         bubbles.Remove(bubble);
     }
     if (!bubblePools.Contains(bubble))
     {
         bubblePools.Add(bubble);
     }
 }
Esempio n. 3
0
    public void ShowBubble(DialogueUIData data)
    {
        SingleBubble bubble;

        if (bubblePools.Count <= 0)
        {
            bubble = Clone();
        }
        else
        {
            bubble = bubblePools[0];
            bubblePools.RemoveAt(0);
        }
        bubbles.Add(bubble);
        bubble.Show(data);
    }