private void Move(char command) { int speed = command == 'F' ? 1 : -1; switch (_compass.GetDirection()) { case 'N': _y = MathHelper.Modulo(_y + speed, _mapYSize); break; case 'S': _y = MathHelper.Modulo(_y - speed, _mapYSize); break; case 'E': _x = MathHelper.Modulo(_x + speed, _mapXSize); break; case 'W': _x = MathHelper.Modulo(_x - speed, _mapXSize); break; } }
private void UpdateCompass() { double direction = 0; if (compass.GetDirection(ref direction)) { textBox1.Text = direction.ToString(); } int speedX, speedY, speedZ; speedX = speedY = speedZ = 0; if (compass.GetAngularSpeed(ref speedX, ref speedY, ref speedZ)) { textBox2.Text = speedX.ToString(); textBox3.Text = speedY.ToString(); textBox4.Text = speedZ.ToString(); } }