public void Player_move(string direction) { if (LocalPlayer.Instance != null) { var lp = LocalPlayer.Instance; Point translation; switch (direction) { case "up": translation = new Point(0, -1); break; case "down": translation = new Point(0, 1); break; case "right": translation = new Point(1, 0); break; case "left": translation = new Point(-1, 0); break; default: throw new Exception(); } translation = translation * LocalPlayer.PLAYER_MOVE_SPEED; lp.Position += translation; GraphicsDrawer.MoveShape(lp.Shape, lp.Position); CommunicationManager.Instance.MoveObject(lp.Id, lp.Position); } }
public void MovePlayer(string id, Point position) { GraphicsDrawer.MoveShape(players[id].Shape, position); }