public override void OnHit(ref Ball b) { b.changed = true; b = new GhostBall(b); GameManager.AddScoreByFactor(); StateSaver.SetBallState(StateSaver.BallStates.Transform); }
public void Ball_TestGhostPassthroughBrick() { Ball b = new GhostBall(new PointF(460, 220)); b.moveVector = new SizeF(0, -1.0f); b.Update(); b.Update(); //Check if it passes through a brick Assert.AreEqual(new SizeF(0, -1.0f), b.moveVector); //Check if it doesn't change type Assert.AreEqual(typeof(GhostBall), b.GetType()); }
public void Ball_TestGhostOnWallHit() { RectangleF gf = GameManager.gameField; GameManager.bricks = new Brick[0,0]; PointF pos = new PointF(gf.Left + 1.0f, gf.Bottom / 2.0f); SizeF move = new SizeF(-1.0f, 0f); Ball b = new GhostBall(pos); b.moveVector = move; b.Update(); b.Update(); b.Update(); Assert.AreEqual(new SizeF(1.0f, 0f), b.moveVector); //Check if it changes back to regular after hitting the wall. Assert.AreEqual(typeof(RegularBall), GameManager.player.ball.GetType()); }