private void checkMouseDoubleClick() { //If double click, load the layer with its children, else switch size if (mouseClicks == 2) { BubbleContent bc = GetComponent <BubbleContent>(); print(bc.data); LevelManager.CreateBubble(bc.data); } else { if (gameObject.transform.localScale.x == smallSize.x) { gameObject.transform.localScale = mediumSize; } else if (gameObject.transform.localScale.x == mediumSize.x) { gameObject.transform.localScale = largeSize; } else if (gameObject.transform.localScale.x == largeSize.x) { gameObject.transform.localScale = smallSize; } } //Reset Flags mouseClickStart = false; mouseClicks = 0; }
//Create a clone of the existing Prefab public static void createClone(string data) { //Create Bubble clone GameObject PrefabClone = Instantiate(Resources.Load("Bubble")) as GameObject; float rand = 2f; PrefabClone.transform.localScale = new Vector3(rand, rand, rand); BubbleContent bc = PrefabClone.GetComponent<BubbleContent>(); bc.data = data; //Create textbox clone Canvas = GameObject.FindGameObjectWithTag("Canvas"); GameObject PrefabClone1 = Instantiate(Resources.Load("Text")) as GameObject; PrefabClone1.transform.localScale = new Vector3(rand/3, rand/3, rand/3); PrefabClone1.transform.parent = Canvas.transform; Text text = PrefabClone1.GetComponent<Text>(); text.text = data; //Add current bubble and respective textbox to list textboxes.Add(new TextControl { textbox = PrefabClone1, Bubble = PrefabClone}); }