示例#1
0
 public Paddle(Side side, GameOfPong game)
 {
     _side   = side;
     _game   = game;
     _world  = game.World;
     _ball   = _world["ball"];
     _pixels = new PlayerMissile[Size];
     for (var i = 0; i < Size; i++)
     {
         _pixels[i] = new PlayerMissile(
             "paddle" +
             (_side == Side.Right ? 'R' : 'L') +
             i,
             _side == Side.Right ? 7 : 0,
             i,
             _world);
     }
     _world.Coinc +=
         (s, a) => {
         if (_ball.X == 0 && _side == Side.Left)
         {
             _game.BallGoingRight = true;
         }
         if (_ball.X == 7 && _side == Side.Right)
         {
             _game.BallGoingRight = false;
         }
     };
 }
示例#2
0
        /// <summary>
        /// Entry point called by the ConsoleBootLoader project
        /// </summary>
        /// <param name="args">Array of object references to the hardware features</param>
        public static void Run(object[] args)
        {
            var thread = new GameOfPong(new ConsoleHardwareConfig(args)).Run();

            thread.Join();
        }