예제 #1
0
 public void Throws_if_created_without_all_destination_inputs()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         DestinationCheck.Against(null);
     });
 }
예제 #2
0
        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());
        }
예제 #3
0
        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();
            });
        }
예제 #4
0
        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);
        }
예제 #5
0
        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));
            }
        }