public IEnumerator Paddle1CanMoveUpY() { GameObject[] paddles = _setup.CreatePaddlesForTest(); Camera cam = _setup.CreateCameraForTest(); paddles[0].GetComponent <Paddle>().MoveUpY("Paddle1"); yield return(new WaitForFixedUpdate()); Assert.AreNotEqual(0f, paddles[0].transform.position.y); }
public IEnumerator BallCanMoveIn2d() { _setup.DestroyAll(); GameObject ball = _setup.CreateBallForTest(); _setup.CreateCameraForTest(); Vector2 original = new Vector2(ball.transform.position.x, ball.transform.position.y); ball.GetComponent <Ball>().SetSpeed(1, -1); yield return(null); Vector2 current = new Vector2(ball.transform.position.x, ball.transform.position.y); Assert.AreNotEqual(original, current); }
public IEnumerator Paddle1StaysInUpperCameraBounds() { Camera cam = _setup.CreateCameraForTest(); GameObject[] paddles = _setup.CreatePaddlesForTest(); float time = 0; while (time < 5) { paddles[0].GetComponent <Paddle>().RenderPaddle(); paddles[0].GetComponent <Paddle>().MoveUpY("Paddle1"); time += Time.deltaTime; } yield return(new WaitForFixedUpdate()); Assert.LessOrEqual(paddles[0].transform.position.y, 4.15); //edge of paddle should not leave edge of screen }