예제 #1
0
 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();
     }
 }
예제 #2
0
 public void Set(AudioSource audioSource,
                 Animator anim,
                 BubbleWave wave,
                 Vector3 position)
 {
     this.audioSource = audioSource;
     this.anim        = anim;
     this.wave        = wave;
     this.position    = position;
 }
예제 #3
0
 private void playNext()
 {
     if (!wave)
     {
         wave = GetComponentInChildren <BubbleWave>();
     }
     if (nextBubbles.Count > 0)
     {
         nextBubbles[1].playSound();
         wave.stopSound();
     }
 }
예제 #4
0
    // BUBBLE ACTIONS

    public void releaseBubble()
    {
        if (!anim)
        {
            anim = GetComponent <Animator>();
        }
        anim.SetTrigger("release");
        if (!wave)
        {
            wave = GetComponentInChildren <BubbleWave>();
        }
        wave.stopSound();
    }
예제 #5
0
 public void stopSound()
 {
     if (!wave)
     {
         wave = GetComponentInChildren <BubbleWave>();
     }
     if (!audioSource)
     {
         audioSource = GetComponent <AudioSource>();
     }
     audioSource.Stop();
     wave.stopSound();
 }
예제 #6
0
 // 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;
 }
예제 #7
0
    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;
        }
    }