示例#1
0
        public void Bounce(IReadOnlyCollection <IBrick> bricks, IBall ball)
        {
            var obstacles = bricks.Cast <IBoundary>().ToList();

            Bounce(obstacles, ball, out var degreeType);
            if (degreeType != DegreeType.None)
            {
                ball.CalculateNewDegree(degreeType);
            }
        }
示例#2
0
        private void BounceBall(IBall ball)
        {
            if (BounceSmallBall(ball))
            {
                return;
            }

            if (BounceBallFromCorner(ball))
            {
                ball.CalculateNewDegree();
                return;
            }

            if (BounceBigBall(ball))
            {
                ball.CalculateNewDegree();
                return;
            }

            if (BounceBigBallUnusual(ball))
            {
                return;
            }
        }
示例#3
0
 public void Bounce(IPad pad, IBall ball)
 {
     BounceBall(pad, ball, out DegreeType type);
     ball.CalculateNewDegree(type);
 }