Example #1
0
        public virtual void CameraInput()
        {
            if (!Camera.main)
            {
                Debug.Log("Missing a Camera with the tag MainCamera, please add one.");
            }
            if (!keepDirection)
            {
                cc.UpdateTargetDirection(Camera.main.transform);
            }
            RotateWithCamera(Camera.main.transform);

            if (tpCamera == null || lockCamera)
            {
                return;
            }
            var Y    = rotateCameraYInput.GetAxis();
            var X    = rotateCameraXInput.GetAxis();
            var zoom = cameraZoomInput.GetAxis();

            tpCamera.RotateCamera(X, Y);
            tpCamera.Zoom(zoom);

            // change keedDirection from input diference
            if (keepDirection && Vector2.Distance(cc.input, oldInput) > 0.2f)
            {
                keepDirection = false;
            }
        }
        public virtual void CameraInput()
        {
            if (!keepDirection)
            {
                character.UpdateTargetDirection(Camera.main.transform);
            }
            RotateWithCamera(Camera.main.transform);

            if (tpCamera == null || lockCamera)
            {
                return;
            }
            var Y    = rotateCameraYInput.GetAxis();
            var X    = rotateCameraXInput.GetAxis();
            var zoom = cameraZoomInput.GetAxis();

            tpCamera.RotateCamera(X, Y);
            tpCamera.Zoom(zoom);

            // change keedDirection from input diference
            if (keepDirection && Vector2.Distance(character.input, oldInput) > 0.2f)
            {
                keepDirection = false;
            }
        }