public void playSound() { if (!wave) { wave = GetComponentInChildren <BubbleWave>(); } if (!audioSource) { audioSource = GetComponent <AudioSource>(); } if (nextBubbles.Count == 1) { Debug.Log("Playing sound 1 next"); audioSource.loop = false; audioSource.Play(); Invoke("playNext", audioSource.clip.length); wave.playSound(); } else { Debug.Log("Playing sound "); audioSource.loop = true; audioSource.Play(); wave.playSound(); } }
public void Set(AudioSource audioSource, Animator anim, BubbleWave wave, Vector3 position) { this.audioSource = audioSource; this.anim = anim; this.wave = wave; this.position = position; }
private void playNext() { if (!wave) { wave = GetComponentInChildren <BubbleWave>(); } if (nextBubbles.Count > 0) { nextBubbles[1].playSound(); wave.stopSound(); } }
// BUBBLE ACTIONS public void releaseBubble() { if (!anim) { anim = GetComponent <Animator>(); } anim.SetTrigger("release"); if (!wave) { wave = GetComponentInChildren <BubbleWave>(); } wave.stopSound(); }
public void stopSound() { if (!wave) { wave = GetComponentInChildren <BubbleWave>(); } if (!audioSource) { audioSource = GetComponent <AudioSource>(); } audioSource.Stop(); wave.stopSound(); }
// Use this for initialization void Start() { changeColor(selectedColor); mesh = GetComponent <Renderer>(); audioSource = GetComponent <AudioSource>(); anim = GetComponent <Animator>(); nextBubbles = new List <Bubble>(); wave = GetComponentInChildren <BubbleWave>(); if (wave) { wave.playSound(); } scaleUnit = 1.1f; selectedColor = Color.RED; }
public void changeColor(Color color) { if (!wave) { wave = GetComponentInChildren <BubbleWave>(); } if (!mesh) { mesh = GetComponent <Renderer>(); } wave.changeColor(color); switch (color) { case Color.NONE: mesh.material = none; break; case Color.RED: setMaterial(red); break; case Color.GREEN: setMaterial(green); break; case Color.BLUE: setMaterial(blue); break; case Color.YELLOW: setMaterial(yellow); break; case Color.PURPLE: setMaterial(purple); break; } }