Exemplo n.º 1
0
 private void OnEnable()
 {
     ResetCam.resetCam(Camera.main);
     dirIndicator.SetActive(true);
     dirBar.SetActive(true);
     isEnabled = true;
 }
Exemplo n.º 2
0
    public void changeLoc(int val)
    {
        try
        {
            if (locations.currentStoredLocation != trialPiars[val].locationName)
            {
                locations.locationFunctionPairs[trialPiars[val].locationName].Invoke();
            }

            currentLocNumber = val;
            inputField.text  = val.ToString();
            m_Dropdown.value = val;

            StartCoroutine(setProjectors(val));
            ResetCam.resetCam();
            OnLocationChange(m_Dropdown);
        }
        catch (System.Exception e) { }
    }
Exemplo n.º 3
0
 private void OnEnable()
 {
     pitchButton.SetActive(true);
     ResetCam.resetCam();
 }
Exemplo n.º 4
0
 private void OnEnable()
 {
     ResetCam.resetCam();
 }
Exemplo n.º 5
0
 private void OnEnable()
 {
     ResetCam.resetCam(Camera.main);
     ResetCam.resetCam(setCam);
     isEnabled = true;
 }
Exemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        if (!EventSystem.current.IsPointerOverGameObject())
        {
            if (Input.touchCount == 1)
            {
                foreach (Touch t in Input.touches)
                {
                    if (t.phase == TouchPhase.Began)
                    {
                    }
                    else if (t.phase == TouchPhase.Moved)
                    {
                        if (isActive)
                        {
                            Vector3    worldP = topCam.ScreenToWorldPoint(new Vector3(t.position.x, t.position.y, 1200));
                            Vector3    dir    = (worldP - setCam.transform.position).normalized;
                            RaycastHit hit;
                            Physics.Raycast(topCam.transform.position + (dir * topCam.nearClipPlane), dir, out hit, topCam.farClipPlane);


                            if (move_time == 0)
                            {
                                move_time = Time.time;
                            }
                            stationary_time = 0;
                            endTouch        = hit.point;
                            endSphere.transform.position = hit.point;
                            startSphere.SetActive(false);
                            endSphere.SetActive(true);
                            if (Time.time - move_time >= 0.2)
                            {
                                viewPane.SetActive(true);
                            }

                            touchEndPosPanel.transform.position = t.position;
                            touchEndPosPanel.SetActive(true);
                            if (coroutine != null)
                            {
                                StopCoroutine(coroutine);
                            }

                            Vector3 startViewOffset = new Vector3();
                            Vector3 endViewOffset   = new Vector3();

                            while (Physics.Linecast(startTouch + startViewOffset, endTouch + endViewOffset))
                            {
                                startViewOffset += new Vector3(0, 0.1f, 0);
                                endViewOffset   += new Vector3(0, 0.01f, 0);
                            }
                            //touchStartPosPanel.transform.position = (setCam.WorldToScreenPoint(startTouch + startViewOffset));
                            coroutine = TouchController.OrientCamera(Camera.main, startTouch + startViewOffset, endTouch + endViewOffset, Rate);

                            StartCoroutine(coroutine);
                        }
                    }
                    else if (t.phase == TouchPhase.Ended)
                    {
                        stationary_time = 0;
                        if (isActive)
                        {
                            isActive = false;
                            viewPane.SetActive(false);
                            endSphere.SetActive(false);
                            touchStartPosPanel.SetActive(false);
                            touchEndPosPanel.SetActive(false);
                            ResetCam.resetCam(Camera.main);
                            ResetCam.resetCam(topCam);
                            //StartCoroutine(TouchController.OrientCamera(Camera.main, new Vector3(526,1000,526), new Vector3(90,0,0), Rate * 0.3f));
                            ResetCam.resetCam(setCam);
                            oldTouchPositions[0]             = null;
                            oldTouchPositions[1]             = null;
                            viewPane.transform.localPosition = new Vector3(-8.8f, -7.7f, 0);
                            viewPane.transform.eulerAngles   = new Vector3();
                        }
                    }
                    else if (t.phase == TouchPhase.Stationary)
                    {
                        move_time = 0;
                        if (stationary_time == 0)
                        {
                            stationary_time = Time.time;
                        }

                        if (isActive == false && (Time.time - stationary_time) > 1f)
                        {
                            Vector3    worldP = Camera.main.ScreenToWorldPoint(new Vector3(t.position.x, t.position.y, 1200));
                            Vector3    dir    = (worldP - Camera.main.transform.position).normalized;
                            RaycastHit hit;
                            Physics.Raycast(Camera.main.transform.position + (dir * Camera.main.nearClipPlane), dir, out hit, Camera.main.farClipPlane);

                            isActive   = true;
                            startTouch = hit.point + new Vector3(0, 2, 0);
                            startSphere.transform.position = hit.point;
                            startSphere.SetActive(true);
                            viewPane.SetActive(true);



                            touchStartPosPanel.transform.position = (topCam.WorldToScreenPoint(hit.point));
                            touchStartPosPanel.transform.position = new Vector3(touchStartPosPanel.transform.position.x, touchStartPosPanel.transform.position.y, 0);
                            touchStartPosPanel.SetActive(true);
                        }
                        else
                        {
                            if (Time.time - stationary_time > 0.5 && Time.time - stationary_time < 1.0f)
                            {
                                //topCam.transform.eulerAngles = new Vector3(90, Camera.main.transform.eulerAngles.y, 0);
                                topCam.transform.RotateAround(endSphere.transform.position, new Vector3(0, 1, 0), Camera.main.transform.eulerAngles.y);

                                setCam.transform.eulerAngles = new Vector3(90, Camera.main.transform.eulerAngles.y, 0);
                            }
                            else if (Time.time - stationary_time > 1 && Time.time - stationary_time < 3.0f)
                            {
                                viewPane.SetActive(false);
                            }
                            else if (Time.time - stationary_time > 3)
                            {
                                endSphere.SetActive(false);
                            }
                        }
                    }
                }
            }
        }
    }