Пример #1
0
    public void PressedKey(sSimpleNote newNote)
    {
        if (busy)
        {
            return;
        }
        myOrgan.PlayNoteInstant(newNote);
        if (riddleMelody == null || riddleMelody.Length < 1)
        {
            return;
        }

        if (newNote.tone == riddleMelody[enteredTones.Count])
        {
            if (enteredTones.Count + 1 < riddleMelody.Length)
            {
                enteredTones.Add(newNote.tone);
            }
            else
            {
                Success(newNote.timeUntilNext);
            }
        }
        else
        {
            Failure(newNote.timeUntilNext);
        }
    }
Пример #2
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);
         }
     }
 }
Пример #3
0
    /// <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));
        }
    }
Пример #4
0
    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();
    }
Пример #5
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);
         }
     }
 }
Пример #6
0
 /// <summary>
 /// specific reaction
 /// </summary>
 protected abstract void Resonate(sSimpleNote note, sSimpleTone tone);
Пример #7
0
 protected override void Resonate(sSimpleNote note, sSimpleTone tone)
 {
     StartCoroutine(GlowUp(note.timeUntilNext));
 }
Пример #8
0
 protected override void Resonate(sSimpleNote note, sSimpleTone tone)
 {
     StartCoroutine(Shivering(note.timeUntilNext, note.volume * tone.volume));
 }