Ejemplo n.º 1
0
 //Collections of methods related to setting up components of the game.
 //Setups format manager that is used to store how text should be drawn.
 //SetupBoard used to creating the game board and spaces.
 //Setups a timer that checks for refresh messagse from the server.
 private void SetupGame(SizeEnum size)
 {
     FormatManager.SetupFormatManager(size);
     SetupBoard(size);
     timer.SetupGameTimer(UpdateFromServer);
     GetSpacesFromServer();
     CreatePlayer();
     GetCurrentPlayer();
     players = GetPlayersFromServer();
     camera.centerOnGameObject(board.GetStartingSpace());
 }
Ejemplo n.º 2
0
        //Creates board and list of players.
        //Set up server for to recieve players.
        //Create socket for clients to connect too.
        public void SetupServer()
        {
            Console.WriteLine("Setting up server");
            FormatManager.SetupFormatManager(SizeEnum.Large);
            board = new GameBoard(0, 0, Color.Blue, new Size(2048, 2048));

            players       = new List <Player>();
            die           = new Die();
            isServerFull  = false;
            playerCounter = 0;

            serverSocket.Bind(new IPEndPoint(IPAddress.Any, 6969));
            serverSocket.Listen(4);
            serverSocket.BeginAccept(new AsyncCallback(AcceptCallback), null);
            Console.WriteLine("Server Ready");
        }
Ejemplo n.º 3
0
        private void SetupGame(SizeEnum size)
        {
            FormatManager.SetupFormatManager(size);
            SetupBoard(size);
            totalTimeElapsed = 0;
            timer.SetupGameTimer(RecordTime);
            camera.centerOnGameObject(gameObjects[4]);

            //Generate players
            players = new List <Player>(1)
            {
                new Player(0, board.GetStartingSpace(), Color.Red),
                new Player(1, board.GetStartingSpace(), Color.Blue),
                new Player(2, board.GetStartingSpace(), Color.Green),
                new Player(3, board.GetStartingSpace(), Color.Yellow)
            };
            currentPlayer = 0;
            gameObjects.AddRange(players);
        }