public void Throws_if_created_without_all_destination_inputs() { Assert.Throws <ArgumentNullException>(() => { DestinationCheck.Against(null); }); }
public void The_desired_destination_is_not_in_the_string_representation() { var neverMoving = new NeverMoving(); var check = DestinationCheck.Against(neverMoving); var expectedString = "{" + "PlayerMovedLastFrame=" + check.PlayerMovedLastFrame() + "}"; Assert.AreEqual(expectedString, check.ToString()); }
public void There_is_no_desired_destination() { var neverMoving = new NeverMoving(); var check = DestinationCheck.Against(neverMoving); Assert.IsFalse(check.PlayerMovedLastFrame()); Assert.Throws <InvalidOperationException>(() => { check.DesiredDestination(); }); }
public void There_is_a_desired_destination() { var alwaysMoving = new AlwaysMoving(); var check = DestinationCheck.Against(alwaysMoving); Assert.IsTrue(check.PlayerMovedLastFrame()); var destination = check.DesiredDestination(); Assert.AreEqual( alwaysMoving.Destination, destination); }
private void FixedUpdate() { var check = DestinationCheck.Against(config.Create()); if (check.PlayerMovedLastFrame()) { var y = gameObject.transform.position.y; var destination = check.DesiredDestination(); movementSystem.MoveEntityTowardsDestination( entity, new Vector3(destination.x, y, destination.z)); } }