Skip to content

Instantly share code, notes, and snippets.

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/c5b01dd3d5c5ab75bcbf to your computer and use it in GitHub Desktop.
Save elbruno/c5b01dd3d5c5ab75bcbf to your computer and use it in GitHub Desktop.
El Bruno - XboxOne Controller ProcessMovements for Rocket Launcher
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