예제 #1
0
파일: GameHub.cs 프로젝트: MatasGos/BMAN
        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);
            });
        }
예제 #2
0
 private void OnMoveLeftUp(object sender, GamePadEventArgs args) => MoveLeftUp?.Invoke();