private void OnMouseDown() { SaveBubble save = new SaveBubble(transform, Color.HSVToRGB(m_Hue, m_Saturation, m_Value), GetComponent <AudioSource>(), note, son, Time.time); if (Bullegenerator.saveBubblesBool) { Bullegenerator.allBubblesCreated.Add(save); } Bullegenerator.CreateBubble(save); }
private void OnTriggerEnter(Collider other) { if (!this.alreadyTrigger) { this.alreadyTrigger = true; SaveBubble save = new SaveBubble(transform, Color.HSVToRGB(m_Hue, m_Saturation, m_Value), GetComponent <AudioSource>(), note, son, Time.time); if (Bullegenerator.saveBubblesBool) { Bullegenerator.allBubblesCreated.Add(save); } Bullegenerator.CreateBubble(save); } }
public static void CreateBubble(SaveBubble save) { GameObject sphere = GameObject.Instantiate(GameObject.Find("BubbleExample"), save.sourceTransform); sphere.AddComponent <Bubble>(); sphere.transform.SetParent(save.sourceTransform.root.transform);//on désigne le cube comme parent de l'objet sphere.transform.GetComponent <Renderer>().material.color = save.color; sphere.gameObject.GetComponent <Bubble>().myAudioSource = save.audio; sphere.gameObject.GetComponent <Bubble>().note = save.note; sphere.gameObject.GetComponent <Bubble>().son = save.son; sphere.transform.position = save.sourceTransform.position; //objects.Add(sphere); GameObject invSphere = GameObject.Instantiate(GameObject.Find("BubbleExampleReverse"), save.sourceTransform); invSphere.AddComponent <ReversedBubble>(); invSphere.transform.SetParent(save.sourceTransform.root.transform);//on désigne le cube comme parent de l'objet invSphere.transform.GetComponent <Renderer>().material.color = save.color; invSphere.transform.position = save.sourceTransform.position; //objects.Add(invSphere); }