Beispiel #1
0
 public void Initialize()
 {
     X = Camp.BoardWidth / 2;
     Y = Camp.BoardHeight / 2;
     _camp.Board[X, Y]  = Camp.Ball;
     DirectionMovementX = (DirectionMovementX)_random.Next(0, 2);
     DirectionMovementY = (DirectionMovementY)_random.Next(0, 2);
 }
Beispiel #2
0
 public void OnRoofChangeDirection()
 {
     if (DirectionMovementY == DirectionMovementY.Up)
     {
         DirectionMovementY = DirectionMovementY.Down;
     }
     else if (DirectionMovementY == DirectionMovementY.Down)
     {
         DirectionMovementY = DirectionMovementY.Up;
     }
 }
Beispiel #3
0
        public void Move(DirectionMovementY direction)
        {
            if (direction == DirectionMovementY.Up && Y - 1 > 0)
            {
                _camp.Board[X, Y] = Camp.Empty;
                Y--;
            }
            else if (direction == DirectionMovementY.Down && Y + 1 < Camp.BoardHeight - 1)
            {
                _camp.Board[X, Y] = Camp.Empty;
                Y++;
            }

            if (_sidePlayer == SidePlayer.Left)
            {
                _camp.Board[X, Y] = Camp.PlayerLeft;
            }
            else
            {
                _camp.Board[X, Y] = Camp.PlayerRight;
            }
        }