Walls. THE WALLS!

Once we had the level framed and the textures were mostly lining up, I needed to cover the smaller areas where you could still see the blue background.  This is shown in the following picture.

Level Befoe Walls.png

So to accomplish this, I needed to know where each tile ended and started at the floor.  From there I could figure out where I needed to cover with walls.  So the first script I was called every time a texture was made by the BuildFloor script and added its transform to a List.  Then once the program ran, it would get the upper right and upper left points of Floor Tiles.

public void NewWallLocation(Transform incomingTransform){

mWallTransforms.Add(incomingTransform);
}

void SetWallPoints(){

for(int i = 0; i < mWallTransforms.Count; i++){

Vector3 tempPosition = Vector3.one;
tempPosition.x = mWallTransforms[i].position.x -mWallTransforms[i].localScale.x * mStandardTileSideLength;
tempPosition.y = mWallTransforms[i].position.y + mWallTransforms[i].localScale.z * mStandardTileSideLength;
tempPosition.z = mZDistance;

mWallPoints.Add (tempPosition);

tempPosition.x = mWallTransforms[i].position.x + mWallTransforms[i].localScale.x * mStandardTileSideLength;
tempPosition.y = (mWallTransforms[i].position.y + mWallTransforms[i].localScale.z * mStandardTileSideLength);
tempPosition.z = mZDistance;

mWallPoints.Add (tempPosition);

}
}

From this, I wrote out all the cases that the program might run into to: 

- The startPosition could be above the endPosition and they could have the same x value.  This means the wall points are directly above each other and you need to build a wall from start to end facing to the right of the level.

-  The start Position could be below the end Position and they could have the same x value.  This means the wall points are directly above each other just like the previous build but the wall needs to face to the left instead of the right.

The next cases all brought up problems because they involved the a situation where there was a hole in the floor.  In all three hole cases, they do not have the same x values. But their startPosition could be higher, lower, or the same height as the endPosition.  This is easy to spot with respect to the previous 2 examples and simple to implement.  I only need to spawn walls fromt he startPosition and the end Position to the mLowestFloorPosition(-13 in unity space in our case).  One will face right and the other will face left. The problem arises with the sixth case.

The sixth case is when both ends of the same texture are selected.  This looks exactly like a hole but it is different in that walls should not be spawned at all.  To solve this problem, I realized that the only time walls would ever spawn was on odd points in the array, so between points 1 and 2 between 3 and 4 and so on.  The texture issue would only arise on even numbers of the array, 0 to 1.  This is because the wall points were added in pairs, each texture has two corners.  So I only needed to check every other corner.

Before implementing this though, our level designer did something cool; he just placed floors two spaces lower than the main floor to make a hole where he wanted.  I think this just looks better aesthetically and from a  design perspective, it allows the player to better see that their robot will not be moving anymore. So as a result, I did not have to implement the hole option into the code.

The Final result does not have our artistically pleasing wall texture but it does not look bad and can be seen below.

Level 1 walls.png