Created
July 5, 2014 19:43
-
-
Save elbruno/c5b01dd3d5c5ab75bcbf to your computer and use it in GitHub Desktop.
El Bruno - XboxOne Controller ProcessMovements for Rocket Launcher
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
private void ProcessMovements(MoveDirection moveDirection, bool fire) | |
{ | |
switch (moveDirection.CombinedXy) | |
{ | |
case MoveDirections.Center: | |
_rocket.StopMovements(); | |
break; | |
case MoveDirections.Left: | |
case MoveDirections.LeftFar: | |
_rocket.MoveLeft(); | |
break; | |
case MoveDirections.Right: | |
case MoveDirections.RightFar: | |
_rocket.MoveRight(); | |
break; | |
case MoveDirections.Up: | |
case MoveDirections.UpFar: | |
_rocket.MoveUp(); | |
break; | |
case MoveDirections.Down: | |
case MoveDirections.DownFar: | |
_rocket.MoveDown(); | |
break; | |
default: | |
_rocket.StopMovements(); | |
break; | |
} | |
if (fire) | |
{ | |
_rocket.FireOnce(); | |
} | |
MovementText = string.Format("direction: {0} - fire:{1}", moveDirection.CombinedXy, fire); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment