void CameraTransition(_PlaneteCamera next)
        {
            actualIndex = next.index;

            if (oldFace != null)
            {
                oldFace.vCam.Priority = 0;
            }
            currentFace = next;
            currentFace.vCam.Priority = 20;
            baseVCam.Priority         = 0;
            oldFace = currentFace;
        }
Example #2
0
        void CheckTouch()
        {
            if (isMobilePlatform == true)
            {
                touch = Input.GetTouch(0);
                ray   = Camera.main.ScreenPointToRay(touch.position);

                if (Physics.Raycast(ray, out hit))
                {
                    nextFace = hit.collider.gameObject.GetComponent <_PlaneteCamera>();

                    if (hit.collider.gameObject.GetComponent <_PlaneteCamera>() == true)
                    {
                        nextFace = hit.collider.gameObject.GetComponent <_PlaneteCamera>();
                    }
                    else if (hit.collider.gameObject.tag == "Moon")
                    {
                        planeteView = false;
                        audioSource.Play();
                        _MOON.instance.MoveToMoon();
                        return;
                    }

                    if (nextFace != null && touch.phase == TouchPhase.Ended)
                    {
                        if (planeteView == true)
                        {
                            nextFace.isActive = true;
                            nextFace.ActivatePSFB();
                            audioSource.Play();
                            foreach (_PlaneteCamera faces in raycastFaces)
                            {
                                faces.gameObject.GetComponent <Collider>().enabled = false;
                            }

                            facesSpeed    = rotationSpeed * 0.33f;
                            rotationSpeed = facesSpeed;
                        }

                        OnZoomToPlanetCalls();

                        CameraTransition(nextFace);
                        if (isMoonDisabled == false)
                        {
                            StartCoroutine(DisableMoon());
                            isMoonDisabled = true;
                        }
                        planeteView = false;
                    }
                }
            }
            else
            {
                mouse = Input.mousePosition;
                ray   = Camera.main.ScreenPointToRay(mouse);

                if (Physics.Raycast(ray, out hit))
                {
                    if (hit.collider.gameObject.GetComponent <_PlaneteCamera>() == true)
                    {
                        nextFace = hit.collider.gameObject.GetComponent <_PlaneteCamera>();
                    }
                    else if (hit.collider.gameObject.tag == "Moon")
                    {
                        planeteView = false;
                        audioSource.Play();
                        _MOON.instance.MoveToMoon();
                        return;
                    }

                    if (nextFace != null)
                    {
                        if (planeteView == true)
                        {
                            nextFace.isActive = true;
                            nextFace.ActivatePSFB();
                            audioSource.Play();
                            foreach (_PlaneteCamera faces in raycastFaces)
                            {
                                faces.gameObject.GetComponent <Collider>().enabled = false;
                            }

                            facesSpeed    = rotationSpeed * 0.33f;
                            rotationSpeed = facesSpeed;
                        }

                        OnZoomToPlanetCalls();

                        CameraTransition(nextFace);
                        if (isMoonDisabled == false)
                        {
                            StartCoroutine(DisableMoon());
                            isMoonDisabled = true;
                        }
                        planeteView = false;
                    }
                }
            }
        }
        void CheckTouch()
        {
            if (Application.isMobilePlatform == true)
            {
                touch = Input.GetTouch(0);
                ray   = Camera.main.ScreenPointToRay(touch.position);

                if (Physics.Raycast(ray, out hit))
                {
                    Debug.Log("Touch Hit " + hit.collider.gameObject.name);
                    nextFace = hit.collider.gameObject.GetComponent <_PlaneteCamera>();

                    if (nextFace != null && touch.phase == TouchPhase.Ended)
                    {
                        if (planeteView == true)
                        {
                            nextFace.isActive = true;
                            nextFace.ActivatePSFB();
                            foreach (_PlaneteCamera faces in raycastFaces)
                            {
                                faces.gameObject.GetComponent <Collider>().enabled = false;
                            }

                            facesSpeed    = rotationSpeed * 0.33f;
                            rotationSpeed = facesSpeed;
                        }

                        CameraTransition(nextFace);
                        planeteView = false;
                    }
                }
            }
            else
            {
                mouse = Input.mousePosition;
                ray   = Camera.main.ScreenPointToRay(mouse);

                if (Physics.Raycast(ray, out hit))
                {
                    Debug.Log("Touch Hit " + hit.collider.gameObject.name);
                    nextFace = hit.collider.gameObject.GetComponent <_PlaneteCamera>();

                    if (nextFace != null && Input.GetMouseButtonUp(0))
                    {
                        if (planeteView == true)
                        {
                            nextFace.isActive = true;
                            nextFace.ActivatePSFB();
                            foreach (_PlaneteCamera faces in raycastFaces)
                            {
                                faces.gameObject.GetComponent <Collider>().enabled = false;
                            }

                            facesSpeed    = rotationSpeed * 0.33f;
                            rotationSpeed = facesSpeed;
                        }

                        CameraTransition(nextFace);
                        planeteView = false;
                    }
                }
            }
        }