public IEnumerator if_the_player_is_in_air_should_no_be_grounded() { NPC_side_scroll_motor_2d motor = player.GetComponent <NPC_side_scroll_motor_2d>(); Assert.IsFalse(motor.is_grounded); yield return(null); }
public IEnumerator when_touch_the_floor_shoud_be_grounded() { NPC_side_scroll_motor_2d motor = player.GetComponent <NPC_side_scroll_motor_2d>(); yield return(new WaitForSeconds(1)); Assert.IsTrue(motor.is_grounded); yield return(null); }
public IEnumerator touch_right_wall_should_player_be_walled() { NPC_side_scroll_motor_2d motor = player_right.GetComponent <NPC_side_scroll_motor_2d>(); Assert.IsFalse(motor.is_walled); Assert.IsTrue(motor.is_not_walled); yield return(new WaitForSeconds(1)); Assert.IsTrue(motor.is_walled); Assert.IsFalse(motor.is_not_walled); }
public IEnumerator after_the_jump_is_grounded_should_be_false() { yield return(new WaitForSeconds(1)); NPC_side_scroll_motor_2d motor = player.GetComponent <NPC_side_scroll_motor_2d>(); Assert.IsTrue(motor.is_grounded); motor.jump(); yield return(new WaitForSeconds(0.1f)); Assert.IsFalse(motor.is_grounded); yield return(null); }
public IEnumerator can_jump_if_the_player_is_grounded() { yield return(new WaitForSeconds(1)); NPC_side_scroll_motor_2d motor = player.GetComponent <NPC_side_scroll_motor_2d>(); Assert.IsTrue(motor.is_grounded); float y_position_in_the_floor = motor.transform.position.y; motor.jump(); yield return(new WaitForSeconds(0.1f)); Assert.Greater( motor.transform.position.y, y_position_in_the_floor); yield return(null); }
public IEnumerator when_is_in_floor_should_no_fall() { NPC_side_scroll_motor_2d motor = player.GetComponent <NPC_side_scroll_motor_2d>(); yield return(new WaitForSeconds(1)); Assert.IsTrue(motor.is_grounded); float started_y_point = player.transform.position.y; yield return(new WaitForSeconds(1)); float current_y_point = player.transform.position.y; Assert.AreEqual(started_y_point, current_y_point, 0.1f); }
public IEnumerator when_touch_the_floor_should_no_add_gravity() { NPC_side_scroll_motor_2d motor = player.GetComponent <NPC_side_scroll_motor_2d>(); yield return(new WaitForSeconds(1)); Assert.IsTrue(motor.is_grounded); Rigidbody2D rigidbody = player.GetComponent <Rigidbody2D>(); float current_y_velocity = rigidbody.velocity.y; Assert.LessOrEqual(current_y_velocity, 0.1f); yield return(new WaitForSeconds(1)); current_y_velocity = rigidbody.velocity.y; Assert.LessOrEqual(current_y_velocity, 0.1f); }