Esempio n. 1
0
 public override void SmothZoomInOut(CameraManagerBase _Camera, int _ZoomState, float _ZoomSpeed)
 {
     if (_ZoomState == (int)ZOOM_STATE._OUT)
     {
         _Camera.fieldOfView = Mathf.Clamp(_Camera.fieldOfView + (_ZoomSpeed * Time.deltaTime), _Camera.ZoomMin(), _Camera.ZoomMax());
     }
     else if (_ZoomState == (int)ZOOM_STATE._IN)
     {
         _Camera.fieldOfView = Mathf.Clamp(_Camera.fieldOfView - (_ZoomSpeed * Time.deltaTime), _Camera.ZoomMin(), _Camera.ZoomMax());
     }
 }
Esempio n. 2
0
    public override void SmothZoomInOut(CameraManagerBase _Camera, float _ZoomSpeed)
    {
        if (Input.touchCount == 2)
        {
            if (Input.GetTouch(0).phase == TouchPhase.Moved && Input.GetTouch(1).phase == TouchPhase.Moved)
            {
                Touch touch  = Input.GetTouch(0);
                Touch touch2 = Input.GetTouch(1);

                curDist  = touch.position - touch2.position;
                prevDist = (touch.position - touch.deltaPosition) - (touch2.position - touch2.deltaPosition);

                float delta = curDist.magnitude - prevDist.magnitude;

                if (delta < 0)
                {
                    if (ZoomState == (int)ZOOM_STATE._NULL)
                    {
                        _Camera.fieldOfView = Mathf.Clamp(_Camera.fieldOfView + (_ZoomSpeed * Time.deltaTime), _Camera.ZoomMin(), _Camera.ZoomMax());
                    }


                    if (_Camera.fieldOfView >= _Camera.ZoomMax())
                    {
                        ZoomState = (int)ZOOM_STATE._OUT;
                    }
                    else
                    {
                        ZoomState = (int)ZOOM_STATE._NULL;
                    }
                }
                else
                {
                    if (ZoomState == (int)ZOOM_STATE._NULL)
                    {
                        _Camera.fieldOfView = Mathf.Clamp(_Camera.fieldOfView - (_ZoomSpeed * Time.deltaTime), _Camera.ZoomMin(), _Camera.ZoomMax());
                    }

                    if (_Camera.fieldOfView <= _Camera.ZoomMin())
                    {
                        ZoomState = (int)ZOOM_STATE._IN;
                    }
                    else
                    {
                        ZoomState = (int)ZOOM_STATE._NULL;
                    }
                }
            }
        }
    }
Esempio n. 3
0
 public virtual void SmothZoomInOut(CameraManagerBase _Camera, int _ZoomState, float _ZoomSpeed)
 {
 }