Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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