Example #1
0
        public void InitializeGame()
        {
            if (!offline && (!client.Initialized() || !server.Initialized()))
            {
                throw new Exception("Connection unitialized. Can't start a game");
            }
            if (offline)
            {
                left  = new HumanPlayer(Side.LEFT);
                right = new HumanPlayer(Side.RIGHT);
            }
            else if (isServer)
            {
                left  = new HumanPlayer(Side.LEFT);
                right = new NetworkPlayer(Side.RIGHT);
            }
            else
            {
                left  = new NetworkPlayer(Side.LEFT);
                right = new HumanPlayer(Side.RIGHT);
            }
            WorldController wrld     = new WorldController(left, right, server, client, isServer);
            Overseer        overseer = new Overseer(wrld);
            BallObject      ball     = new BallObject(left, right, overseer);

            wrld.AttachBall(ball);
            using (var game = new Pong(left, right, ball))
                game.Run();
        }
Example #2
0
 public void InitializeGame()
 {
     if (!offline && (!client.Initialized() || !server.Initialized()))
         throw new Exception("Connection unitialized. Can't start a game");
     if (offline) {
         left = new HumanPlayer(Side.LEFT);
         right = new HumanPlayer(Side.RIGHT);
     } else if (isServer) {
         left = new HumanPlayer(Side.LEFT);
         right = new NetworkPlayer(Side.RIGHT);
     } else {
         left = new NetworkPlayer(Side.LEFT);
         right = new HumanPlayer(Side.RIGHT);
     }
     WorldController wrld = new WorldController(left, right, server, client, isServer);
     Overseer overseer = new Overseer(wrld);
     BallObject ball = new BallObject(left, right, overseer);
     wrld.AttachBall(ball);
     using (var game = new Pong(left, right, ball))
         game.Run();
 }
Example #3
0
 public Overseer(WorldController wrld)
 {
     worldController = wrld;
 }
Example #4
0
 public Overseer(WorldController wrld)
 {
     worldController = wrld;
 }