private void GetFloorCollision()
    {
        Rect floorRect = new Rect();

        for (int row = 0; row < mapData.Height; ++row)
        {
            for (int col = 0; col < mapData.Width; ++col)
            {
                Tile currentTile = mapData[row, col];
                if (IsNormalCollision(currentTile))
                {
                    if (row + 1 < mapData.Height)
                    {
                        Tile aboveTile = mapData[row + 1, col];
                        if (IsNormalCollision(aboveTile))
                        {
                            continue;
                        }
                    }
                    else
                    {
                        return;
                    }
                    floorRect.x = col;
                    floorRect.y = row;

                    while (IsInBounds(row + 1, col + 1))
                    {
                        currentTile = mapData[row, col + 1];
                        if (row + 1 < mapData.Height)
                        {
                            Tile aboveTile = mapData[row + 1, col];
                            if (IsNormalCollision(aboveTile))
                            {
                                --col;
                                break;
                            }
                        }
                        if (IsNormalCollision(currentTile))
                        {
                            ++col;
                        }
                        else
                        {
                            break;
                        }
                    }

                    float floorWidth = col - floorRect.x + 1;

                    floorRect.width  = floorWidth;
                    floorRect.height = 1;

                    RectangleMesh floorMesh = new RectangleMesh(floorRect);
                    floorMesh.BuildHorizontalMesh();
                    meshes.Add(floorMesh.Mesh);
                }
            }
        }
    }
    private void GetCeilingCollision()
    {
        Rect ceilingRect = new Rect();

        for (int row = mapData.Height - 1; row >= 0; --row)
        {
            for (int col = 0; col < mapData.Width; ++col)
            {
                Tile currentTile = mapData[row, col];
                if (IsNormalCollision(currentTile))
                {
                    if (row - 1 >= 0)
                    {
                        Tile belowTile = mapData[row - 1, col];
                        if (IsNormalCollision(belowTile))
                        {
                            continue;
                        }
                    }
                    else
                    {
                        continue;
                    }
                    ceilingRect.x = col;
                    ceilingRect.y = row;

                    while (IsInBounds(row - 1, col + 1))
                    {
                        currentTile = mapData[row, col + 1];
                        if (row - 1 >= 0)
                        {
                            Tile belowTile = mapData[row - 1, col];
                            if (IsNormalCollision(belowTile))
                            {
                                --col;
                                break;
                            }
                        }
                        if (IsNormalCollision(currentTile))
                        {
                            ++col;
                        }
                        else
                        {
                            break;
                        }
                    }

                    float floorWidth = col - ceilingRect.x + 1;

                    ceilingRect.width  = floorWidth;
                    ceilingRect.height = 0;

                    RectangleMesh ceilingMesh = new RectangleMesh(ceilingRect);
                    ceilingMesh.BuildHorizontalMesh();
                    ceilingMesh.InvertMesh();
                    meshes.Add(ceilingMesh.Mesh);
                }
            }
        }
    }
	private void GetFloorCollision ()
	{
		Rect floorRect = new Rect();

		for (int row = 0; row < mapData.Height; ++row)
		{
			for (int col = 0; col < mapData.Width; ++col)
			{
				Tile currentTile = mapData[row, col];
				if (IsNormalCollision(currentTile))
				{
					if (row + 1 < mapData.Height)
					{
						Tile aboveTile = mapData[row + 1, col];
						if (IsNormalCollision(aboveTile))
						{
							continue;
						}
					}
					else
					{
						return;
					}
					floorRect.x = col;
					floorRect.y = row;
					
					while (IsInBounds(row + 1, col + 1))
					{
						currentTile = mapData[row, col + 1];
						if (row + 1 < mapData.Height)
						{
							Tile aboveTile = mapData[row + 1, col];
							if (IsNormalCollision(aboveTile))
							{ 
								--col;
								break;
							}
						}
						if (IsNormalCollision(currentTile))
						{
							++col;
						}
						else
						{
							break;
						}
					} 
					
					float floorWidth = col - floorRect.x + 1;
					
					floorRect.width  = floorWidth;
					floorRect.height = 1;
					
					RectangleMesh floorMesh = new RectangleMesh(floorRect);
					floorMesh.BuildHorizontalMesh();
					meshes.Add (floorMesh.Mesh);
				}
				
			}
		}
	}
	private void GetCeilingCollision ()
	{
		Rect ceilingRect = new Rect();
		
		for (int row = mapData.Height - 1; row >= 0; --row)
		{
			for (int col = 0; col < mapData.Width; ++col)
			{
				Tile currentTile = mapData[row, col];
				if (IsNormalCollision(currentTile))
				{
					if (row - 1 >= 0)
					{
						Tile belowTile = mapData[row - 1, col];
						if (IsNormalCollision(belowTile))
						{
							continue;
						}
					}
					else
					{
						continue;
					}
					ceilingRect.x = col;
					ceilingRect.y = row;
					
					while (IsInBounds(row - 1, col + 1))
					{
						currentTile = mapData[row, col + 1];
						if (row - 1 >= 0)
						{
							Tile belowTile = mapData[row - 1, col];
							if (IsNormalCollision(belowTile))
							{ 
								--col;
								break;
							}
						}
						if (IsNormalCollision(currentTile))
						{
							++col;
						}
						else
						{
							break;
						}
					}
					
					float floorWidth = col - ceilingRect.x + 1;
					
					ceilingRect.width  = floorWidth;
					ceilingRect.height = 0;
					
					RectangleMesh ceilingMesh = new RectangleMesh(ceilingRect);
					ceilingMesh.BuildHorizontalMesh();
					ceilingMesh.InvertMesh();
					meshes.Add (ceilingMesh.Mesh);
				}
			}
		}
	}