Exemplo n.º 1
0
    public bool PlayAudioListT(float DelayBetweenAudio, float InitialDelay, List <TuneCardScript> TuneCards, EPlayingMode PlayMode)
    {
        if (CurPlayingMode != EPlayingMode.None)
        {
            return(false);
        }
        else
        {
            Iterator             = 0;
            ClipTimer            = 0;
            Delay                = DelayBetweenAudio;
            PlayingTuneCards     = new List <TuneCardScript>(TuneCards);
            AudioListSize        = PlayingTuneCards.Count - 1;
            AudioSourceComp.clip = MusicNotes[PlayingTuneCards[Iterator].Key].Value;
            CurrentClipLength    = MusicNotes[PlayingTuneCards[Iterator].Key].Value.length + Delay;


            if (InitialDelay > 0)
            {
                CurPlayingMode    = EPlayingMode.InitialDelay;
                NextPlayingMode   = PlayMode;
                InitialDelayTimer = 0;
                this.InitialDelay = InitialDelay;
            }
            else
            {
                CurPlayingMode = PlayMode;
                AudioSourceComp.Play();
                PlayingTuneCards[Iterator].SetGlow(true);
            }
            return(true);
        }
    }
Exemplo n.º 2
0
    void Update()
    {
        if (CurPlayingMode == EPlayingMode.InitialDelay)
        {
            InitialDelayTimer += Time.deltaTime;
            if (InitialDelayTimer > InitialDelay)
            {
                PlayingTuneCards[Iterator].SetGlow(true);
                AudioSourceComp.Play();
                CurPlayingMode  = NextPlayingMode;
                NextPlayingMode = EPlayingMode.None;
            }
        }
        else if (CurPlayingMode != EPlayingMode.None && CurPlayingMode != EPlayingMode.SingleNote)
        {
            LoopAudioList();
        }
        else if (CurPlayingMode == EPlayingMode.SingleNote)
        {
            if (!AudioSourceComp.isPlaying)
            {
                if (!PlayingWrongNoteAnim && CurPlayingCard != null)
                {
                    CurPlayingCard.SetGlow(false);
                    CurPlayingMode = EPlayingMode.None;
                    CurPlayingCard = null;
                }

                if (WinGame)
                {
                    onEndSequencePlay(true);
                }
            }
        }
    }
Exemplo n.º 3
0
 void Start()
 {
     CurPlayingMode       = EPlayingMode.None;
     Iterator             = 0;
     AudioListSize        = 0;
     ClipTimer            = 0;
     CurrentClipLength    = 0;
     PlayingWrongNoteAnim = false;
     WinGame         = false;
     NextPlayingMode = EPlayingMode.None;
 }
Exemplo n.º 4
0
    void LoopAudioList()
    {
        ClipTimer += Time.deltaTime;
        if (ClipTimer >= CurrentClipLength)
        {
            ClipTimer = 0;
            AudioSourceComp.Stop();

            if (Iterator < AudioListSize)
            {
                Iterator++;
                if (CurPlayingMode == EPlayingMode.Question)
                {
                    AudioSourceComp.clip = MusicNotes[LevelInfo.Sequence[Iterator]].Value;
                    CurrentClipLength    = MusicNotes[LevelInfo.Sequence[Iterator]].Value.length;
                }
                else if (CurPlayingMode == EPlayingMode.Hint)
                {
                    PlayingTuneCards[Iterator - 1].SetGlow(false);
                    AudioSourceComp.clip = MusicNotes[PlayingTuneCards[Iterator].Key].Value;
                    CurrentClipLength    = MusicNotes[PlayingTuneCards[Iterator].Key].Value.length + Delay;
                    PlayingTuneCards[Iterator].SetGlow(true);
                }
                else if (CurPlayingMode == EPlayingMode.Answer)
                {
                    PlayingTuneCards[Iterator - 1].SetGlow(false);
                    AudioSourceComp.clip = MusicNotes[PlayingTuneCards[Iterator].Key].Value;
                    CurrentClipLength    = MusicNotes[PlayingTuneCards[Iterator].Key].Value.length + Delay;
                    PlayingTuneCards[Iterator].SetGlow(true);
                }
                AudioSourceComp.Play();
            }
            else
            {
                if (CurPlayingMode == EPlayingMode.Question)
                {
                    onSequencePlay(false);
                }
                else if (CurPlayingMode != EPlayingMode.None)
                {
                    PlayingTuneCards[Iterator].SetGlow(false);
                    if (CurPlayingMode == EPlayingMode.Answer)
                    {
                        onEndSequencePlay(false);
                    }
                }
                CurPlayingMode = EPlayingMode.None;
            }
        }
    }
Exemplo n.º 5
0
 public bool PlayTuneCard(TuneCardScript TuneCard)
 {
     if (CurPlayingMode != EPlayingMode.None)
     {
         return(false);
     }
     else
     {
         CurPlayingMode = EPlayingMode.SingleNote;
         CurPlayingCard = TuneCard;
         CurPlayingCard.SetGlow(true);
         PlayMusicNote((NoteType)CurPlayingCard.Key);
         return(true);
     }
 }
Exemplo n.º 6
0
 public bool PlayAudioListT()
 {
     if (CurPlayingMode != EPlayingMode.None)
     {
         return(false);
     }
     else
     {
         CurPlayingMode       = EPlayingMode.Question;
         Iterator             = 0;
         ClipTimer            = 0;
         AudioListSize        = LevelInfo.Sequence.Count - 1;
         AudioSourceComp.clip = MusicNotes[LevelInfo.Sequence[Iterator]].Value;
         CurrentClipLength    = MusicNotes[LevelInfo.Sequence[Iterator]].Value.length;
         AudioSourceComp.Play();
         onSequencePlay(true);
         return(true);
     }
 }