Beispiel #1
0
 /// <summary>
 /// decides if sound is worth a reaction
 /// </summary>
 protected void HearedSound(sSimpleNote sound)
 {
     if (sound.tone == resonatingTone && sound.timeUntilNext > 0)
     {
         sSimpleTone tone = pipeOrgan.gamut.Get(resonatingTone);
         if (tone != null)
         {
             Resonate(sound, tone);
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// plays shouts of the character
 /// </summary>
 /// <param name="shout"></param>
 private void PlayShout(sSimpleTone shout)
 {
     if (shout.audioClip != null)
     {
         if (voice.clip == null || !voice.isPlaying)
         {
             voice.clip   = shout.audioClip;
             voice.volume = shout.volume;
             voice.pitch  = shout.pitch;
             voice.Play();
         }
     }
 }
Beispiel #3
0
 /// <summary>
 /// plays the given sfx
 /// </summary>
 private void PlaySound(sSimpleTone sound)
 {
     if (sound.audioClip != null)
     {
         footNoiseOrigin.clip   = sound.audioClip;
         footNoiseOrigin.volume = sound.volume;
         footNoiseOrigin.pitch  = sound.pitch;
         footNoiseOrigin.Play();
     }
     else
     {
         Debug.Log(this.name + " tried playing empty Sfx.");
     }
 }
 public void PlayTone(sSimpleTone tone, float volumeMod, float pitchMod)
 {
     if (tone.audioClip != null)
     {
         audioSources[audioSourceIndex].clip   = tone.audioClip;
         audioSources[audioSourceIndex].volume = tone.volume * volumeMod;
         audioSources[audioSourceIndex].pitch  = Mathf.Clamp(tone.pitch * pitchMod, 0, 3);
         audioSources[audioSourceIndex].Play();
         audioSourceIndex = (audioSourceIndex + 1 < audioSources.Length) ? audioSourceIndex + 1 : 0;
     }
     else
     {
         Debug.Log(gameObject.name + " tried to play empty Tone.");
     }
 }
    /// <summary>
    /// instantly plays a given Note
    /// </summary>
    public void PlayNoteInstant(sSimpleNote note)
    {
        sSimpleTone tone = gamut.Get(note.tone);

        PlayTone(tone, note.volume, note.pitch);
        if (singleNote != null)
        {
            singleNote(note);
        }
        if (MovementScript.ghostWorldActive && mySymbol)
        {
            mySymbol.ShowSymbol(tone.symbol);
            StartCoroutine(mySymbol.DelayedHideSymbol(note.timeUntilNext));
        }
    }
    private IEnumerator PlaySong(int id)
    {
        if (songStart != null)
        {
            songStart(id);
        }
        currentlyPlaying     = true;
        currentlyPlayingSong = id;
        sMelody currentMelodie = this.melodies[id];

        if (currentMelodie.speed <= 0)
        {
            instance.melodies[id].speed = 1;
        }

        for (int i = 0; i < currentMelodie.melody.Length; i++)
        {
            sSimpleNote note = currentMelodie.melody[i];
            sSimpleTone tone = gamut.Get(note.tone);

            if (tone != null)
            {
                PlayTone(tone, note.volume * currentMelodie.volume, note.pitch * currentMelodie.pitch);
                if (singleNote != null)
                {
                    singleNote(note);
                }
                if (MovementScript.ghostWorldActive && mySymbol)
                {
                    mySymbol.ShowSymbol(tone.symbol);
                }
            }

            yield return(new WaitForSeconds(note.timeUntilNext / currentMelodie.speed));
        }
        if (mySymbol)
        {
            mySymbol.HideSymbol();
        }
        //Debug.Log("Song ended");
        if (songEnded != null)
        {
            songEnded(id);
        }
        currentlyPlaying = false;
        NextSong();
    }
Beispiel #7
0
 protected override void Resonate(sSimpleNote note, sSimpleTone tone)
 {
     if (nextPan < pans.Length && pans[nextPan] != null)
     {
         pans[nextPan].LockAndMoveCamera();
     }
     nextPan++;
     if (nextPan >= pans.Length)
     {
         pipeOrgan.singleNote -= HearedSound;
         pipeOrgan.songStart  -= StartHearingSong;
         pipeOrgan.songEnded  -= EndHearingSong;
         if (destroyComponentAfterLast)
         {
             Destroy(this);
         }
     }
 }
Beispiel #8
0
 /// <summary>
 /// specific reaction
 /// </summary>
 protected abstract void Resonate(sSimpleNote note, sSimpleTone tone);
Beispiel #9
0
 protected override void Resonate(sSimpleNote note, sSimpleTone tone)
 {
     StartCoroutine(GlowUp(note.timeUntilNext));
 }
Beispiel #10
0
 protected override void Resonate(sSimpleNote note, sSimpleTone tone)
 {
     StartCoroutine(Shivering(note.timeUntilNext, note.volume * tone.volume));
 }