Example #1
0
        public override bool Aim(ref Setup setup)
        {
            bool result = false;

            if (joystick == null || !joystick.IsInteracting())
            {
                Vector2 vector = touchDelta * TouchSensitivity / Screen.width;
                if (vector.sqrMagnitude > minDelta)
                {
                    float num  = Mathf.Clamp(vector.y, -1f, 1f) * MaxPitch;
                    float num2 = Mathf.Clamp(vector.x, -1f, 1f) * MaxYaw;
                    if (InvertYaw)
                    {
                        num2 = 0f - num2;
                    }
                    if (InvertPitch)
                    {
                        num = 0f - num;
                    }
                    Quaternion quaternion  = Quaternion.AngleAxis(num, setup.Camera.right);
                    Quaternion quaternion2 = Quaternion.AngleAxis(num2, setup.Camera.up);
                    setup.Glance = quaternion2 * quaternion;
                    result       = true;
                }
            }
            return(result);
        }