Exemple #1
0
        public GameLobbyInformationDto CreateLobby(string userId, string lobbyName, string password = null)
        {
            var pushygame = new PushyGame(userId);
            var newLobby  = new GameLobby <PushyGame>(pushygame, lobbyName, userId, Context.ConnectionId, GameType.PUSHY, 2, password);

            _gameScope.AddLobby(newLobby);
            return(newLobby.ToDto(this._userService));
        }
Exemple #2
0
        public void MoveBox()
        {
            var game    = new PushyGame("awd");
            var gameStr = game.ToString();

            Console.WriteLine(gameStr);
            DoMove(game, PushyMoveDirection.Down);
            DoMove(game, PushyMoveDirection.Down);

            DoMove(game, PushyMoveDirection.Right);
            DoMove(game, PushyMoveDirection.Down);
            DoMove(game, PushyMoveDirection.Left);
            DoMove(game, PushyMoveDirection.Left);
            DoMove(game, PushyMoveDirection.Left);
            DoMove(game, PushyMoveDirection.Left);

            DoMove(game, PushyMoveDirection.Left);
        }
Exemple #3
0
        private bool DoMove(PushyGame game, PushyMoveDirection dir)
        {
            var fieldCopy = game.Field.Copy();

            var figData = fieldCopy.GetFigureData("awd");
            var success = fieldCopy.TryMove(figData.Figure, figData.X, figData.Y, (PushyMoveDirection)dir);

            if (success)
            {
                game.Field = fieldCopy;
            }

            game.Field.TryMove(figData.Figure, figData.X, figData.Y, (PushyMoveDirection)dir);
            var gameStr = game.ToString();

            Console.WriteLine(gameStr);
            return(true);
        }