public static void PerformCharacterMovement(Character charToMove, Map map)
        {
            float currentDestinationX = charToMove.movementProfile.currentDestinationPixels.X;
            float currentDestinationY = charToMove.movementProfile.currentDestinationPixels.Y;
            float currentLocationX = charToMove.pixelPosition.X;
            float currentLocationY = charToMove.pixelPosition.Y;
            Tile originalTile = map.tiles[(int)charToMove.position.X, (int)charToMove.position.Y];

            //if the character is within deltaX or detaY of the destination, move them there and make the next segment active.
            float distanceFromDestX = Math.Abs(currentDestinationX - currentLocationX);
            float distanceFromDestY = Math.Abs(currentDestinationY - currentLocationY);

            if (distanceFromDestX < Character.movementSpeedX || distanceFromDestY < Character.movementSpeedY)
            {
                //switch to next segment along character path
                int indexOfCurrentSegment = charToMove.movementProfile.currentpath.characterPath.IndexOf(charToMove.movementProfile.currentSegment);
                int numberOfSegmentsInPath = charToMove.movementProfile.currentpath.characterPath.Count();

                if (indexOfCurrentSegment == numberOfSegmentsInPath - 1)
                {
                    //we're done, stop movement
                    charToMove.state = charState.still;
                    charToMove.subtractCurrentActionPoints(charToMove.movementProfile.currentPathActionPointCost);
                    charToMove.position.X = charToMove.movementProfile.finalDestination.xPos;
                    charToMove.position.Y = charToMove.movementProfile.finalDestination.yPos;

                    originalTile.isOccupied = false;
                    Tile destinationTile = map.tiles[(int)charToMove.position.X, (int)charToMove.position.Y];
                    Vector2 destTilePosVector = new Vector2(destinationTile.xPos,destinationTile.yPos);
                    charToMove.pixelPosition = charToMove.getPixelPositionByTilePosition(destTilePosVector);
                    destinationTile.isOccupied = true;
                }
                else
                {
                    //We're not done - there are more segments in this character's current path. Move to the next, then call the movement function again.

                    charToMove.pixelPosition = new Vector2(currentDestinationX,currentDestinationY);

                    charToMove.movementProfile.currentSegment = charToMove.movementProfile.currentpath.characterPath[indexOfCurrentSegment + 1];
                    charToMove.movementProfile.currentDestination = charToMove.movementProfile.currentSegment.segmentTiles.Last();
                    Tile newDestinationTile = charToMove.movementProfile.currentDestination;
                    Vector2 newDestinationVector = new Vector2(newDestinationTile.xPos, newDestinationTile.yPos);
                    charToMove.movementProfile.currentDestinationPixels = charToMove.getPixelPositionByTilePosition(newDestinationVector);
                    PerformCharacterMovement(charToMove, map);
                }

            }

            if (currentDestinationX > currentLocationX)
            {
                currentLocationX += Character.movementSpeedX;
            }
            else if (currentDestinationX < currentLocationX)
            {
                currentLocationX -= Character.movementSpeedX;
            }
            else
            {
                //currentLocation == currentDestination
            }

            if (currentDestinationY > currentLocationY)
            {
                currentLocationY += Character.movementSpeedY;
            }
            else if (currentDestinationY < currentLocationX)
            {
                currentLocationY -= Character.movementSpeedY;
            }
            else
            {
                //currentLocation == currentDestination
            }

            Vector2 newCharLocation = new Vector2(currentLocationX, currentLocationY);
            charToMove.pixelPosition = newCharLocation;
        }