Skip to content

Instantly share code, notes, and snippets.

@elbruno
Created July 5, 2014 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elbruno/bb8f3f2dfc1d1a085948 to your computer and use it in GitHub Desktop.
Save elbruno/bb8f3f2dfc1d1a085948 to your computer and use it in GitHub Desktop.
El Bruno - XBoxOne Joystick Calculate Directions
public static MoveDirections CalculateDirectionY(float y, int yCoeficient)
{
var locationY = MoveDirections.DownFar;
var currentLocationY = y * yCoeficient;
if (currentLocationY > 20000)
{
locationY = MoveDirections.UpFar;
}
else if (currentLocationY > 10000)
{
locationY = MoveDirections.Up;
}
else if (currentLocationY > -10000)
{
locationY = MoveDirections.Center;
}
else if (currentLocationY > -20000)
{
locationY = MoveDirections.Down;
}
return locationY;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment