Exemplo n.º 1
0
 void SecondPortalActivated(TeleportSpot spot)
 {
     if (!_oneWayOnly)
     {
         TeleportPlayer(_firstPortal.transform.position);
     }
 }
Exemplo n.º 2
0
    private void Awake()
    {
        if (!spot1)
        {
            spot1 = this;
            foreach (Draggable dragg in GameObject.FindObjectsOfType <Draggable>())
            {
                dragg.AddSpot(this);
            }
            return;
        }

        if (!spot2)
        {
            foreach (Draggable dragg in GameObject.FindObjectsOfType <Draggable>())
            {
                dragg.AddSpot(this);
            }
            spot2 = this;
        }
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        Vector3 rayDirection = transform.forward * rayLength;

        Debug.DrawRay(transform.position, rayDirection, Color.red, 0.1f);

        RaycastHit hit;

        if (Physics.Raycast(transform.position, rayDirection, out hit))
        {
            // check if we hit a teleport spot
            TeleportSpot teleSpot = hit.collider.GetComponent <TeleportSpot>();

            if (teleSpot != null)
            {
                if (isLeftController)
                {
                    if (ViveInput.Instance.leftTriggerTouch)
                    {
                        Teleport(hit.collider.transform.position);
                    }
                }
                else
                {
                    if (ViveInput.Instance.rightTriggerTouch)
                    {
                        Teleport(hit.collider.transform.position);
                    }
                }

                // TODO
                if (Input.GetMouseButtonDown(0))
                {
                    Teleport(hit.collider.transform.position);
                }

                teleSpot.HighlightOn();
            }
        }
    }
Exemplo n.º 4
0
 void FirstPortalActivated(TeleportSpot spot)
 {
     TeleportPlayer(_secondPortal.transform.position);
 }