Exemplo n.º 1
0
        private void GetNoteGroup(string timer)
        {
            if (null == currentGroup)
            {
                currentGroup = Instantiate(noteGroupPrefab, spawnNotesUnder).GetComponent <NoteCreationGroup>();
                currentGroup.UpdateNoteTime(timer);

                notes.Add(currentGroup);
            }
        }
Exemplo n.º 2
0
        private IEnumerator RecordRoutine()
        {
            float timer = 5;

            while (timer > 0)
            {
                startButtonText.text = "Mueve el bote en " + (int)timer;
                yield return(new WaitForEndOfFrame());

                timer -= Time.deltaTime;
            }


            startButtonText.text =
                noteKeys[0].ToString() + " | " +
                noteKeys[1].ToString() + " | " +
                noteKeys[2].ToString() + " | " +
                noteKeys[3].ToString() + " | " +
                noteKeys[4].ToString() + " | " +
                noteKeys[5].ToString() + " | ";

            timer = 0;
            audioSource.Play();

            while (audioSource.isPlaying)
            {
                if (Input.GetKeyDown(KeyCode.Escape))
                {
                    audioSource.Stop();
                    break;
                }

                timer         += Time.deltaTime;
                timerText.text = String.Format("{0:00}:{1:00}:{2:000}", timer / 60, timer % 60, (timer * 1000) % 1000);

                for (int i = 0; i < noteKeys.Length; i++)
                {
                    CheckNote(noteKeys[i], timerText.text);
                }

                if (loseGroup)
                {
                    loseGroup    = false;
                    currentGroup = null;
                }

                yield return(null);
            }

            // TODO: Aca podes agarrar la data guardada en "notes" y guardarla en un scriptable o algo.
        }