static void BallUpdate(Ball ball) { while (ball.active) { ball.Update(); } balls.Remove(ball); Thread.CurrentThread.Abort(); }
static void AddBall(int x) { if (playerOneScore >= playerTwoScore) { ball = new Ball(x,grid.height - 4 , -1, "O"); } else { ball = new Ball(x, 3, 1, "O"); } balls.Add(ball); Thread ballThread = new Thread(() => BallUpdate(ball)); ballThreads.Add(ballThread); ballThread.Start(); }