예제 #1
0
    //tutorial for physics orb, companion tells how to use it, waits for action (shooting red orb)
    private IEnumerator Introduction()
    {
        float delay = 1.0f;

        companion.SetIdle(false);

        yield return(new WaitForSeconds(1.0f));

        while (companion.IsMoving())
        {
            yield return(new WaitForSeconds(1.0f));
        }

        companion.StartSpeaking(audioClips[0]);
        yield return(new WaitForSeconds(audioClips[0].length + delay));

        Vector3 orbPosition = companion.transform.position + companion.transform.forward;

        orbPosition.y = 22.5f;
        physicsOrb.transform.position = orbPosition;
        physicsOrb.SetActive(true);
        while (!physicsOrb.taken)
        {
            yield return(new WaitForSeconds(1.0f));
        }

        companion.StartSpeaking(audioClips[1]);
        companion.SetAutoFollow(true);

        companion.SetIdle(true);

        yield return(null);
    }
예제 #2
0
파일: Finish.cs 프로젝트: pa-ling/colors_vr
    private IEnumerator FinishSpeaking()
    {
        float delay = 1.0f;

        companion.SetAutoFollow(false);
        companion.SetIdle(false);

        companion.MoveTo(companionPosition.position);

        yield return(new WaitForSeconds(3.0f));

        companion.StartSpeaking(audioClips[0]);
        yield return(new WaitForSeconds(audioClips[0].length + delay));

        yield return(new WaitForSeconds(7.0f));

        companion.StartSpeaking(audioClips[1]);
        yield return(new WaitForSeconds(audioClips[1].length + delay));

        SteamVR_Fade.Start(Color.black, 3.0f);

        yield return(null);
    }
예제 #3
0
    //tutorial: tells player what to do, waits for action of player (moving, shooting, teleporting, switching orbs)
    private IEnumerator Introduction()
    {
        float delay = 1.0f;

        yield return(new WaitForSeconds(5.0f));

        companion.StartSpeaking(audioClips[0]);
        yield return(new WaitForSeconds(audioClips[0].length + delay));

        InvokeRepeating("CompanionSayImHere", 5.0f, 5.0f);

        while (!companion.IsVisibleByAnyCamera())
        {
            yield return(null);
        }

        CancelInvoke("CompanionSayImHere");

        yield return(new WaitForSeconds(1.0f));

        companion.StartSpeaking(audioClips[2]);
        yield return(new WaitForSeconds(audioClips[2].length + delay));

        Vector3 lastCameraPosition = Camera.main.transform.position;

        do
        {
            yield return(new WaitForSeconds(1.0f));
        } while (lastCameraPosition == Camera.main.transform.position);

        companion.StartSpeaking(audioClips[3]);
        yield return(new WaitForSeconds(audioClips[3].length + delay));

        Vector3 orbPosition = companion.transform.position + companion.transform.forward;

        orbPosition.y = 1.5f;
        paintOrb.transform.position = orbPosition;
        paintOrb.SetActive(true);
        while (!paintOrb.taken)
        {
            yield return(new WaitForSeconds(1.0f));
        }

        companion.StartSpeaking(audioClips[4]);
        yield return(new WaitForSeconds(audioClips[4].length + delay));

        VRPlayerController vrPlayerController = player.GetComponent <VRPlayerController>();

        if (vrPlayerController != null)
        {
            vrPlayerController.SetTriggerHintActive(true);
        }

        do
        {
            yield return(new WaitForSeconds(1.0f));
        } while (!paintOrbWasShot);

        if (vrPlayerController != null)
        {
            vrPlayerController.SetTriggerHintActive(false);
        }

        companion.StartSpeaking(audioClips[5]);
        yield return(new WaitForSeconds(audioClips[5].length + delay));

        orbPosition   = companion.transform.position + companion.transform.forward;
        orbPosition.y = 1.5f;
        teleportOrb.transform.position = orbPosition;
        teleportOrb.SetActive(true);
        while (!teleportOrb.taken)
        {
            yield return(new WaitForSeconds(1.0f));
        }

        yield return(new WaitForSeconds(1.0f));

        firstDoor.OpenDoor();
        yield return(new WaitForSeconds(1.0f));

        companion.StartSpeaking(audioClips[6]);
        yield return(new WaitForSeconds(audioClips[6].length + delay));

        companion.SetAutoFollow(true);

        do
        {
            yield return(new WaitForSeconds(1.0f));
        } while (!teleportOrbWasShot);

        yield return(new WaitForSeconds(1.0f));

        companion.StartSpeaking(audioClips[7]);
        yield return(new WaitForSeconds(audioClips[7].length + delay));

        orbChanged = false;

        if (vrPlayerController != null)
        {
            vrPlayerController.SetTouchpadHintActive(true);
        }

        do
        {
            yield return(new WaitForSeconds(1.0f));
        } while (!orbChanged);

        if (vrPlayerController != null)
        {
            vrPlayerController.SetTouchpadHintActive(false);
        }

        companion.StartSpeaking(audioClips[8]);
        yield return(new WaitForSeconds(audioClips[8].length + delay));

        yield return(new WaitForSeconds(1.0f));

        secondDoor.OpenDoor();
        yield return(new WaitForSeconds(1.0f));

        companion.StartSpeaking(audioClips[9]);
        yield return(new WaitForSeconds(audioClips[9].length));

        companion.SetIdle(true);
        yield return(null);
    }