コード例 #1
0
ファイル: BallsDoc.cs プロジェクト: AtanasK/VP
 public void AddBall(Point position)
 {
     Random r = new Random();
     int x = r.Next(2);
     Ball ball = null;
     if (x == 0)
     {
         ball = new Ball(Color.Blue, position);
     }
     else if (x == 1)
     {
         ball = new Ball(Color.Green, position);
     }
     Balls.Add(ball);
 }
コード例 #2
0
ファイル: Ball.cs プロジェクト: AtanasK/VP
 public bool Touches(Ball b)
 {
     return (Position.X - b.Position.X) * (Position.X - b.Position.X) + (Position.Y - b.Position.Y) * (Position.Y - b.Position.Y) <= RADIUS * RADIUS * 4;
 }
コード例 #3
0
ファイル: BallsDoc.cs プロジェクト: AtanasK/VP
 public void AddRed(Point position)
 {
     Ball ball = new Ball(Color.Red, position);
     Balls.Add(ball);
 }