public void RobotValidMove() { _map.MoveRelative(new Vector2Int(1, 0)); Assert.That(_map.GetCurrentPosition(), Is.EqualTo(new Vector2Int(2, 1))); _map.MoveRelative(new Vector2Int(0, -1)); Assert.That(_map.GetCurrentPosition(), Is.EqualTo(new Vector2Int(2, 0))); }
void moveInDirection(string direction) { batteryLife--; exploredMaze = exploration.GetExploredMap(); if (direction == "North") { if (maze[currentX - 1, currentY + 0] == 1) { return; } exploredMaze.MoveRelative(Vector2Int.left); move(-1, 0); robot.transform.Rotate(0.0f, 270f, 0.0f, Space.Self); } else if (direction == "East") { if (maze[currentX, currentY + 1] == 1) { return; } exploredMaze.MoveRelative(Vector2Int.up); move(0, 1); robot.transform.Rotate(0.0f, 0f, 0.0f, Space.Self); } else if (direction == "West") { if (maze[currentX, currentY - 1] == 1) { return; } exploredMaze.MoveRelative(Vector2Int.down); move(0, -1); robot.transform.Rotate(0.0f, -180.0f, 0.0f, Space.Self); } else if (direction == "South") { if (maze[currentX + 1, currentY + 0] == 1) { return; } exploredMaze.MoveRelative(Vector2Int.right); move(1, 0); robot.transform.Rotate(0.0f, 90.0f, 0.0f, Space.Self); } else if (direction == "RNorth") { robotDirection = "North"; robot.transform.Rotate(0.0f, 270f, 0.0f, Space.Self); } else if (direction == "RSouth") { robotDirection = "South"; robot.transform.Rotate(0.0f, 90.0f, 0.0f, Space.Self); } else if (direction == "REast") { robotDirection = "East"; robot.transform.Rotate(0.0f, 0.0f, 0.0f, Space.Self); } else if (direction == "RWest") { robotDirection = "West"; robot.transform.Rotate(0.0f, -180.0f, 0.0f, Space.Self); } }