Created
July 5, 2014 19:41
-
-
Save elbruno/bb8f3f2dfc1d1a085948 to your computer and use it in GitHub Desktop.
El Bruno - XBoxOne Joystick Calculate Directions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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