public void MoveWestSubtractFromXAxis() { var robot = new Robot(new Position(1, 0, "W")); var moveForward = new MoveForward(); robot.CurrentPosition = moveForward.Move(robot.CurrentPosition); Assert.AreEqual(0, robot.CurrentPosition.X); }
public void MoveEastAddToXAxis() { var robot = new Robot(new Position(1, 0, "E")); var moveForward = new MoveForward(); robot.CurrentPosition = moveForward.Move(robot.CurrentPosition); Assert.AreEqual(2, robot.CurrentPosition.X); }
public void MoveSouthSubtractFromYAxis() { var robot = new Robot(new Position(0, 1, "S")); var moveForward = new MoveForward(); robot.CurrentPosition = moveForward.Move(robot.CurrentPosition); Assert.AreEqual(0, robot.CurrentPosition.Y); }
public void MoveNorthAddToYAxis() { var robot = new Robot(new Position(0, 1, "N")); var moveForward = new MoveForward(); robot.CurrentPosition = moveForward.Move(robot.CurrentPosition); Assert.AreEqual(2, robot.CurrentPosition.Y); }
public void MoveForwardRobotTest(float x, float y, float orientation, string expect) { Robot robot = new Robot(x, y, orientation); MoveForward movement = new MoveForward(); movement.Move(robot); Assert.Equal(expect, robot.GetPosition()); }
void FixedUpdate() { // turn the ship Quaternion rotation = transform.rotation; float z = rotation.eulerAngles.z; z += swing * Time.fixedDeltaTime; myRigidBody.MoveRotation(z); // move forward moveScript.Move(Time.fixedDeltaTime); }
public void PlayBlockCode() { var instance = new MoveForward(); //will run the block code for the play button Debug.Log("Play Button Clicked"); //play button works with incuding the code in the "on click" on the play button object button.GetComponent <Button>().onClick.AddListener(delegate { instance.Move(bike); }); //what this does is add the code to the bike object but //you want to add the bike to the code as a game object //you still need it since theres an error in the code?? //instance = bike.AddComponent<MoveForward>(); }
void FixedUpdate() { if (target == null) { target = GameObject.FindGameObjectWithTag("Player").transform; if (target == null) { return; } } var myAngle = RotationHelper.GetAngleFromQuaternion(transform.rotation); var angleToTarget = RotationHelper.GetAngleFromToTarget(transform.position, target.position); var diff = RotationHelper.GetDifferenceBetweenAngles(myAngle, angleToTarget); float nextAngle = transform.rotation.eulerAngles.z; if (diff > 0) { var mod = turnSpeed * Time.fixedDeltaTime; if (mod > diff) { mod = diff; } nextAngle += mod; } else if (diff < 0) { var mod = turnSpeed * Time.fixedDeltaTime; if (mod < diff) { mod = diff; } nextAngle -= mod; } myRigidBody.MoveRotation(nextAngle); moveScript.Move(Time.fixedDeltaTime); }
void FixedUpdate() { moveScript.Move(Time.fixedDeltaTime); }
public void Move_in_the_right_direction_when_command_is_given(RoverPosition startPosition, int command, Coordinates result) { Assert.Equal(result, MoveForward.Move(command, startPosition)); }