示例#1
0
    private IEnumerator StartGame()
    {
        fader.gameObject.SetActive(true);

        Color faderColor = new Color(0f, 0f, 0f, 1f);

        fader.color = faderColor;
        while (fader.color.a > 0)
        {
            faderColor.a -= 1f * Time.deltaTime;
            fader.color   = faderColor;
            yield return(null);
        }

        int sequenceIndex;

        if (GameDataHelper.Instance.isPitchNext)
        {
            sequenceIndex = 0;
        }
        else
        {
            sequenceIndex = 1;
        }

        gameSequenceHelper.gameObject.SetActive(true);
        audioMixer.gameObject.SetActive(true);
        beatVisualizer.gameObject.SetActive(true);
        audioMixer.Initialize(SoundSequenceParserHelper.ParseTextFile(gameSoundSequences[sequenceIndex]));
    }
示例#2
0
    private IEnumerator ShowIntroText()
    {
        Color fadeColor = activeIntroTexts[introTextIndex].color;

        while (activeIntroTexts[introTextIndex].color.a < 1f)
        {
            fadeColor.a += textFadeSpeed;
            activeIntroTexts[introTextIndex].color = fadeColor;
            yield return(null);
        }

        yield return(new WaitForSecondsRealtime(6.5f));

        while (activeIntroTexts[introTextIndex].color.a > 0f)
        {
            fadeColor.a -= textFadeSpeed;
            activeIntroTexts[introTextIndex].color = fadeColor;
            yield return(null);
        }

        if (introTextIndex + 1 < activeIntroTexts.Length)
        {
            introTextIndex++;
            StartCoroutine(ShowIntroText());
        }
        else
        {
            SetAudioActive(true);
            audioMixer.Initialize(SoundSequenceParserHelper.ParseTextFile(activeSoundSequences[soundSequenceIndex]));
            StartCoroutine(ShowArrowKeys());
            soundSequenceIndex++;
        }
    }
示例#3
0
    public void Start()
    {
        if (hasStarted)
        {
            return;
        }

        clipIDs      = SoundSequenceParserHelper.ParseTextFile(soundSequence);
        audioSources = new AudioSource[2];
        samples      = new List <float[]>();
        samples.Add(new float[0]);
        samples.Add(new float[0]);

        idToAudioClipDictionary = new Dictionary <int, AudioClip>();

        for (int i = 0; i < 2; i++)
        {
            GameObject child = new GameObject($"Player {i}");
            child.transform.parent = gameObject.transform;
            audioSources[i]        = child.AddComponent <AudioSource>();
        }

        hasStarted = true;
    }
示例#4
0
    private void CorrectResult()
    {
        beatVisualizer.CorrectInput();

        if (!correctInputOnce)
        {
            correctInputOnce = !correctInputOnce;
            audioMixer.Initialize();
            return;
        }

        if (soundSequenceIndex < activeSoundSequences.Length)
        {
            correctInputOnce = !correctInputOnce;
            HighlightArrowKey(soundSequenceIndex);
            audioMixer.Initialize(SoundSequenceParserHelper.ParseTextFile(activeSoundSequences[soundSequenceIndex]));
            soundSequenceIndex++;
        }
        else
        {
            Debug.Log("Tutorial Completed");
            StartCoroutine(CompleteTutorialAfterSeconds(1f));
        }
    }