Example #1
0
    // Update is called once per frame
    void Update()
    {
        RaycastHit hit;

        if (Physics.SphereCast(Camera.main.transform.position, viewRange, Camera.main.transform.forward, out hit))
        {
            RayCastBase obj = hit.collider.gameObject.GetComponent <RayCastBase>();
            if (obj && current == null)
            {
                obj.OnFocus();
                current = obj;
            }
        }
        else if (current != null)
        {
            current.LostFocus();
            current = null;
        }

        if (current != null &&
            (OVRInput.GetDown(OVRInput.RawButton.A) || Input.GetKeyDown(KeyCode.Space)))
        {
            current.Action(gameObject);
        }
    }
Example #2
0
    public void ActionWithoutFade(GameObject cameraBase)
    {
        if (cameraBase != null)
        {
            if (Current != null)
            {
                Current.gameObject.SetActive(true);
            }

            gameObject.SetActive(false);
            Current = this;

            DoAction(cameraBase.gameObject);
        }
    }
Example #3
0
    public void ChangeToNext(GameObject cameraBase, bool fade = true)
    {
        int          index = Random.Range(0, drones.Length);
        DroneControl drone = RayCastBase.GetCurrent() as DroneControl;

        if (drone)
        {
            index = drones.ToList().IndexOf(drone);
        }

        if (index >= 0 && drones.Length > 0)
        {
            if (fade)
            {
                drones[index].Action(cameraBase);
            }
            else
            {
                drones[index].ActionWithoutFade(cameraBase);
            }
        }
    }