Beispiel #1
0
        public bool SendStartPoint(Guid gameID, Guid userID, Point point = null)
        {
            GameRoom room   = actionGameList.Where(x => x.RoomID == gameID).First();
            Player   player = room.PlayerList.Where(x => x.PlayerID == userID).First();
            MazeArea area   = room.MazeList.Where(x => x.MazeID == player.LabirintID).First(); // Находим лабиринт для данного игрока

            if (point == null)
            {
                point = new Point(5, 5);
            }

            Human human = new Human()
            {
                Position = point
            };

            player.ObjectID = human.ID;

            area.AddGameObject(human);
            player.IsReady = true;

            // TODO : Уберём, если сделаем по кнопке
            if (room.PlayerList.All(x => x.IsReady == true))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        public bool MoveObject(Guid gameID, Guid playerID, MoveDirection direction)
        {
            GameRoom room   = actionGameList.Where(x => x.RoomID == gameID).First();
            Player   player = room.PlayerList.Where(x => x.PlayerID == x.LabirintID).First();

            MazeArea area = room.MazeList.Where(x => x.MazeID == player.LabirintID).First();

            return(area.MoveLiveObject(player.ObjectID, direction)); // TODO: Решить, нужна ли возможность движения разных объектов
        }
Beispiel #3
0
        public void SendStartMaze(Guid gameID, Guid userID, MazeArea maze)
        {
            PackCommand command = new PackCommand(TypeCommand.SendStartMaze);

            command.AddArgument(gameID.ToString());
            command.AddArgument(userID.ToString());
            command.AddArgument(MazeArea.ToXML(maze));

            var resp = connection.SendCommand(command);
        }
Beispiel #4
0
        public void SendStartMaze(Guid gameID, Guid userID, MazeArea area = null)
        {
            GameRoom room   = actionGameList.Where(x => x.RoomID == gameID).First();
            Player   player = room.PlayerList.Where(x => x.PlayerID != userID).First(); // TODO: В других режимах может быть несколько игроков

            if (area == null)
            {
                RecursiveGenerator generator = new MazeGeneral.MazeGenerator.RecursiveGenerator();
                area = new MazeArea();

                area.SetStructLab(generator.Generate(10));
                area.SetExit(MoveDirection.UP, 5);
                area.SetExit(MoveDirection.RIGHT, 5);
                area.SetExit(MoveDirection.LEFT, 5);
                area.SetExit(MoveDirection.DONW, 5);
            }

            player.LabirintID = area.MazeID;
            room.AddMaze(area);
        }
Beispiel #5
0
 public void AddMaze(MazeArea maze)
 {
     MazeList.Add(maze);
 }