Exemplo n.º 1
0
    private void NextVideo()
    {
        Debug.Log("GameController: NextVideo()");
        int testIndex = 0;

#if (UNITY_ANDROID && !UNITY_EDITOR)
        Debug.Log("Switching Video to");
        testIndex = videoPlayerControllers[0].SwitchVideo();
#else
        Debug.Log("VidIndex: " + currVidIndex + ", In location: " + mainCamera.transform.position);
        videoPlayerControllers[currVidIndex].PauseVideo();
        videoPlayerControllers[currVidIndex].StopVideo();

        // tmp
        videoPlayerControllers[currVidIndex].MoveTo(new Vector3(-vidSphereDistance, 0, 0));

        currVidIndex++; // need null index check !!
        if (currVidIndex >= videoPlayerControllers.Length)
        {
            currVidIndex = 0;
        }
        testIndex = currVidIndex;

        // tmp
        videoPlayerControllers[currVidIndex].MoveTo(mainCamera.transform.position);
        // move camera to next sphere locataion
        //mainCamera.transform.position = new Vector3(currVidIndex * vidSphereDistance, 0, 0);

        Debug.Log("VidIndex: " + currVidIndex + ", Moving to location: " + mainCamera.transform.position);
        videoPlayerControllers[currVidIndex].PlayVideo();
#endif
        currAmbiAudioTrack = testIndex;

        videoScenes[currAmbiAudioTrack].soundField.PlayScheduled(0);
        StartCoroutine(FadeInAmbiAudio(videoScenes[currAmbiAudioTrack].soundField, 6f));

        if (currAmbiAudioTrack == 0)
        {
            // for end credits stay silent until after back is pressed
            videoScenes[currAmbiAudioTrack].soundField.Pause();
        }

        if (testIndex == 0)
        {
            lobbyController.ShowCredits();
        }
        else if (testIndex == 1)
        {
            lobbyController.HideLobby();
        }
        // do null array length checks !!
        // disable all transit areas
        for (int i = 0; i < videoScenes.Length; i++)
        {
            videoScenes[i].reticleVisibleArea.SetActive(false);
        }
        // enable the transit area for video after given delay
        StartCoroutine(EnableAfterDelay(videoScenes[testIndex].reticleVisibleArea, videoScenes[testIndex].interactDelay));
        //resetCameraPos(testIndex);
        VidIndexAction(testIndex);
    }