Example #1
0
        private void Dial_RotationChanged(Windows.UI.Input.RadialController sender, Windows.UI.Input.RadialControllerRotationChangedEventArgs args)
        {
            sprite.rotation += (float)args.RotationDeltaInDegrees;
            if (sprite.rotation >= 360 || sprite.rotation <= -360)
            {
                sprite.rotation = 0;
            }

            if (sprite.rotation == 0)
            {
                Rotation = 0;
            }
            else if (sprite.rotation < 0)
            {
                Rotation = (int)Math.Abs(sprite.rotation / 2);
            }
            else if (sprite.rotation > 0)
            {
                Rotation = (int)Math.Abs((sprite.rotation - 360) / 2);
            }
            if (Rotation >= TargetRotation - 10 && Rotation <= TargetRotation + 10)
            {
                World.dial.UseAutomaticHapticFeedback = true;
            }
            else
            {
                World.dial.UseAutomaticHapticFeedback = false;
            }
            catchMech.UpdatePosition(Rotation);
        }
Example #2
0
 public static RadialControllerRotationChangedEventArgs ToUnity(this Windows.UI.Input.RadialControllerRotationChangedEventArgs args)
 {
     return(new RadialControllerRotationChangedEventArgs()
     {
         Contact = args.Contact?.ToUnity(),
         RotationDeltaInDegrees = (float)args.RotationDeltaInDegrees
     });
 }