private void SetBasicTeleport()
 {
     if (bt == null)
     {
         bt = GetComponent <VRTK_BasicTeleport>();
     }
 }
Пример #2
0
    protected void Start()
    {
        if (!spawnPoint)
        {
            spawnPoint = transform;
        }
        teleport = GameMaster.Instance.SceneBehaviour().GetComponent <VRTK_BasicTeleport> ();
        AudioSource[] ass = gameObject.GetComponentsInChildren <AudioSource> ();
        for (int i = 0; i < ass.Length; i++)
        {
            switch (ass[i].name)
            {
            case "Throw":
                sources.Add("throw", ass [i]);
                sources ["throw"].clip = throwSounds [Random.Range(0, throwSounds.Length)];
                break;

            case "Shoot":
                sources.Add("shoot", ass [i]);
                break;

            case "Grab":
                sources.Add("grab", ass [i]);
                break;

            default:
                break;
            }
        }
    }
Пример #3
0
        private new void Awake()
        {
            base.Awake();
            points    = GameObject.FindGameObjectsWithTag("Point");
            basicTele = FindObjectOfType <VRTK_BasicTeleport>();


            GetUIEventListener("GreekButton").PointerClick += OnGreekClick;
            GetUIEventListener("AsianButton").PointerClick += OnAsianClick;
            GetUIEventListener("EgyptButton").PointerClick += OnEgyptClick;
        }
Пример #4
0
    private void HandleResetHit()
    {
        // get start object
        GameObject startObject = GameObject.Find(playerController.GetCurrentCheckpoint());

        Debug.Log(playerController.GetCurrentCheckpoint());

        // get start location
        Vector3 startLocation = startObject.transform.position;

        // teleport to start location
        //playAreaTransform.position = startLocation;
        VRTK_BasicTeleport basicTPScript = this.GetComponent <VRTK_BasicTeleport>();

        basicTPScript.ForceTeleport(startLocation);
    }
Пример #5
0
 /// <summary>
 /// Observable Teleported event
 /// </summary>
 /// <param name="events"></param>
 /// <returns></returns>
 public static IObservable <DestinationMarkerEventArgs> TeleportedAsObservable(this VRTK_BasicTeleport events)
 {
     return(Observable.FromEvent <TeleportEventHandler, DestinationMarkerEventArgs>(
                h => (s, e) => h(e),
                h => events.Teleported += h,
                h => events.Teleported -= h));
 }
Пример #6
0
 void Start()
 {
     _teleport = GetComponent <VRTK_BasicTeleport>();
 }
Пример #7
0
    void teleportChecker()//Instruct user to teleport and checks if user has indeed teleport
    {
        //AI eye game objects -ralph
        happyEye.SetActive(false);//disable happy eye
        if (teleportEyeCounter == 0)
        {
            normalEye.SetActive(true);//enable normal eye
            teleportEyeCounter = 1;
        }


        VRTK_BasicTeleporscript = GameControlObj.GetComponent <VRTK_BasicTeleport>();
        hasteleported           = VRTK_BasicTeleporscript.IfTeleported;
        if (LocalTimer > 4 && LocalTimer <= 19 && hasteleported == false)
        {
            if (check == false)
            {
                // objectToolTip.GetComponent<VRTK_ObjectTooltip>().containerSize = new Vector2(120f, 40f);

                //Plays 3 audio clips after one another instructing user to teleport -ralph
                if (DualDialogCounter == 1)
                {
                    audioTime1 = dialogcontrol.d8teleport.length + LocalTimer;
                    audioTime2 = dialogcontrol.d9FollowInstructions.length + LocalTimer;
                    audTime3   = audioTime1 + audioTime2;
                    dialogcontrol.playSound(dialogcontrol.d8teleport);
                    DualDialogCounter = 2;
                    objectToolTip.GetComponent <VRTK_ObjectTooltip>().UpdateText("You can also teleport");//AI caption -ralph
                }
                if (DualDialogCounter == 2 && LocalTimer > audioTime1)
                {
                    dialogcontrol.playSound(dialogcontrol.d9FollowInstructions);
                    DualDialogCounter = 3;
                    objectToolTip.GetComponent <VRTK_ObjectTooltip>().UpdateText("Follow the instructions");//AI caption -ralph
                }
                if (DualDialogCounter == 3 && LocalTimer > 14)
                {
                    dialogcontrol.playSound(dialogcontrol.d10holdPressAim);
                    DualDialogCounter = 4;
                    objectToolTip.GetComponent <VRTK_ObjectTooltip>().UpdateText("Teleport: Press, Hold, \nAim, and release");
                    check = true;
                }
            }
            controller.SetActive(true);
            trackpad.SetActive(true);
            destPoint.SetActive(true);
            trackpadHint = true;
        }
        else if (LocalTimer > 30 && hasteleported == false)
        {
            DualDialogCounter = 2;
            if (check == true)
            {
                //objectToolTip.GetComponent<VRTK_ObjectTooltip>().containerSize = new Vector2(140f, 35f);
                dialogcontrol.playSound(dialogcontrol.d13RemindTeleport); //AI voice remainding user to teleport -ralph
                //AI eyes game objects -ralph
                normalEye.SetActive(false);                               //disable normal eye
                angryEye.SetActive(true);                                 //enable angry eye
                objectToolTip.GetComponent <VRTK_ObjectTooltip>().UpdateText("Teleport to proceed");

                check = false;
            }
            LocalTimer = -4;
        }
        if (hasteleported == true)
        {
            //AI eyes game objectss -ralph
            normalEye.SetActive(false); //disable normal eye
            angryEye.SetActive(false);  //disble angry eye
            happyEye.SetActive(true);   //enable happy eye
            if (DualAudioClipTeleportVariable == 0)
            {
                DualDialogCounter             = 5;
                DualAudioClipTeleportVariable = 1;
            }
            destPoint.SetActive(false);
            GameControlObj.GetComponent <VRTK_PolicyList>().operation = VRTK_PolicyList.OperationTypes.Ignore;
            GameControlObj.GetComponent <VRTK_PolicyList>().checkType = VRTK_PolicyList.CheckTypes.Tag;

            //objectToolTip.GetComponent<VRTK_ObjectTooltip>().containerSize = new Vector2(140f, 30f);
            if (DualDialogCounter == 5)//Plays two audio clips after one another -ralph
            {
                objectToolTip.GetComponent <VRTK_ObjectTooltip>().UpdateText("Well done!");
                audioTime1 = dialogcontrol.d11WellDone.length + LocalTimer + 0.5f;
                audioTime2 = dialogcontrol.d14TeleportSafty.length;
                audTime3   = audioTime1 + audioTime2;
                dialogcontrol.waitPlaySound(dialogcontrol.d11WellDone);
                DualDialogCounter = 6;
            }
            if (DualDialogCounter == 6 && LocalTimer > audioTime1)
            {
                objectToolTip.GetComponent <VRTK_ObjectTooltip>().UpdateText("Teleport Reduces Injury");
                dialogcontrol.waitPlaySound(dialogcontrol.d14TeleportSafty);
                DualDialogCounter = 7;
            }
            if (DualDialogCounter == 7 && LocalTimer > audTime3)
            {
                stage++;
                check             = true;
                LocalTimer        = 0;
                DualDialogCounter = 8;
            }
            trackpadHint = false;
            controller.SetActive(false);
            trackpad.SetActive(false);
        }
    }