Ejemplo n.º 1
0
 public Pong(Player left, Player right, BallObject ball)
     : base()
 {
     this.left = left;
     this.right = right;
     this.ball = ball;
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 3
0
 public void AttachBall(BallObject ball)
 {
     this.ball = ball;
 }