Пример #1
0
 public GameState(Vector2 BallPosition, Vector2 Player1Position, Vector2 Player2Position, Vector2 InitVelocity,
                  int ScreenHeight)
 {
     Player1      = new Pad(Constants.PLAYER1_INITIAL_RECTANGLE, Player1Position);
     Player2      = new Pad(Constants.PLAYER2_INITIAL_RECTANGLE, Player2Position);
     StartingBall = CurrentBall = new BallServer(BallPosition, InitVelocity, ScreenHeight);
 }
Пример #2
0
        public void Update(TimeSpan gameTime)
        {
            CurrentBall.Update(gameTime, this);
            var outside = CurrentBall.Outside;

            if (outside != Outside.None)
            {
                if (outside == Outside.Left)
                {
                    Player2Score++;
                }
                else if (outside == Outside.Right)
                {
                    Player1Score++;
                }

                CurrentBall = StartingBall;
            }
        }