Beispiel #1
0
        private static IEnumerable<Queue<Ball>> generateReservoir(Game game, byte width, byte height)
        {
            for (var w = 0; w < width; ++w)
            {
                var queue = new Queue<Ball>(height);
                for (var h = 0; h < height; ++h)
                    queue.Enqueue(getBall(game));

                yield return queue;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new instance of the <see cref="BallReservoir"/> class for the given <see cref="Game"/> with the given dimensions.
        /// </summary>
        /// <param name="game">The current game.</param>
        /// <param name="width">The width of the reservoir in Balls.</param>
        /// <param name="height">The height of the reservoir in Balls.</param>
        public BallReservoir(Game game, byte width, byte height)
        {
            if (width < 1)
                throw new ArgumentOutOfRangeException("width", "Width must be greater than 0");

            if (height < 1)
                throw new ArgumentOutOfRangeException("height", "Height must be greater than 0");

            this.game = game;
            Balls = generateReservoir(game, width, height).ToArray();
        }
Beispiel #3
0
 /// <summary>
 /// Creates the <see cref="Ball"/> that this one turns into when thrown off screen.
 /// <para/>
 /// Returns itself by default.
 /// </summary>
 /// <param name="game">The current game.</param>
 /// <returns>The <see cref="Ball"/> that this one turns into when thrown off screen.</returns>
 public virtual Ball GetThrowResult(Game game)
 {
     return this;
 }
Beispiel #4
0
 private static Ball getBall(Game game)
 {
     throw new NotImplementedException();
 }