Пример #1
0
 /// <summary>
 /// Call this method to add 100 points to a player's score.
 /// </summary>
 /// <param name="p">The player to add the score to.</param>
 public void AddScore(Defs.Player p)
 {
     if (p == Defs.Player.P1)
         _scoreP1 += 100;
     if (p == Defs.Player.P2)
         _scoreP2 += 100;
 }
Пример #2
0
        /// <summary>
        /// Call this method to move a paddle.
        /// </summary>
        /// <param name="p">The player whose paddle needs to be moved.</param>
        /// <param name="d">The direction to move the paddle.</param>
        public void MovePaddle(Defs.Player p, Direction d)
        {
            Vector2 force;

            if (d == Direction.UP)
                force = new Vector2(0, -20000);
            else
                force = new Vector2(0, 20000);

            if (p == Defs.Player.P1)
                _paddle1.body.ApplyForce(force);
            else
                _paddle2.body.ApplyForce(force);
        }