public override void Apply() { var ball = _componentManager.Balls[0].Clone(); ball.Speed = new Vector2(ball.Speed.X * -1, ball.Speed.Y); _componentManager.AddBall(ball); ball = _componentManager.Balls[0].Clone(); ball.Speed = new Vector2(ball.Speed.X, ball.Speed.Y * -1); _componentManager.AddBall(ball); }
public override void Apply() { List <IBall> fireBalls = new List <IBall>(); foreach (IBall currentBall in _componentManager.Balls) { var fireBall = _componentManager.BallRepository.GetFireBall(); fireBall.Position = currentBall.Position; fireBall.Speed = currentBall.Speed; fireBalls.Add(fireBall); } _componentManager.RemoveBalls(); foreach (IBall currentFireBall in fireBalls) { _componentManager.AddBall(currentFireBall); } Timer timer = new Timer(3000); timer.Elapsed += ((o, e) => { List <IBall> basicBalls = new List <IBall>(); foreach (IBall currentBall in _componentManager.Balls) { var basicBall = _componentManager.BallRepository.GetBasicBall(); basicBall.Position = currentBall.Position; basicBall.Speed = currentBall.Speed; basicBalls.Add(basicBall); } _componentManager.RemoveBalls(); foreach (IBall currentFireBall in basicBalls) { _componentManager.AddBall(currentFireBall); } timer.Stop(); }); timer.Start(); }