public async Task SendMoveMessage(string moveCommand) { await Task.Run(() => { ICommand command = null; Player p = Server.GetPlayerById(Context.ConnectionId); switch (moveCommand) { case "moveleft": command = new MoveLeft(p, Server.current); break; case "moveright": command = new MoveRight(p, Server.current); break; case "moveup": command = new MoveUp(p, Server.current); break; case "movedown": command = new MoveDown(p, Server.current); break; case "moveleftup": command = new MoveLeftUp(p, Server.current); break; case "moveleftdown": command = new MoveLeftDown(p, Server.current); break; case "moverightup": command = new MoveRightUp(p, Server.current); break; case "moverightdown": command = new MoveRightDown(p, Server.current); break; } p.SetCommand(command); }); }
private void OnMoveLeftUp(object sender, GamePadEventArgs args) => MoveLeftUp?.Invoke();