Пример #1
0
        public bool Hit(MovingBall ball)
        {
            if (this.CalculateDistance(ball) <= this.radius ||
                this.CalculateDistance(ball) <= ball.radius)
            {
                ball.color = "#FF0000";
                this.color = "#FF0000";
                ball.IsHit = true;
                this.IsHit = true;

                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
 public double CalculateDistance(MovingBall ball)
 {
     return(Math.Sqrt(Math.Pow((ball.x - this.x), 2) + Math.Pow((ball.y - this.y), 2)));
 }