/// <summary>
 /// Renders a fog tile
 /// <param name="tile">The fog tile to render</param>
 /// </summary>
 void RenderTile(FogOfWarTile tile)
 {
     Graphics.DrawMesh(m_fogTileMesh,
                       tile.position,
                       Camera.main.transform.rotation,
                       m_fogTileMaterial, 0, null, 0,
                       tile.material,
                       false, false);
 }
    /// <summary>
    /// Creates the fog tile billboards
    /// <param name="width">The width of the game board</param>
    /// <param name="length">The height of the game board</param>
    /// </summary>
    void CreateFogTiles(float width, float length)
    {
        m_fogVelocity.x = 0.5f;
        m_fogVelocity.y = 0.2f;

        const int borderAmount  = 4;
        const int borderOverlap = 2;
        int       amountX       = Mathf.CeilToInt(width / m_fogSize);
        int       amountZ       = Mathf.CeilToInt(length / m_fogSize);

        amountX += borderAmount * 2;
        amountZ += borderAmount * 2;

        for (int x = 0; x < amountX; ++x)
        {
            for (int z = 0; z < amountZ; ++z)
            {
                FogOfWarTile tile = new FogOfWarTile();

                float randX = UnityEngine.Random.Range(-1.0f, 1.0f);
                float randZ = UnityEngine.Random.Range(-1.0f, 1.0f);

                tile.position = new Vector3(
                    (m_fogSize * ((amountX - 1) * 0.5f)) - (x * m_fogSize) + randX,
                    UnityEngine.Random.Range(5.0f, 15.0f),
                    (m_fogSize * ((amountZ - 1) * 0.5f)) - (z * m_fogSize) + randZ);

                m_activeTiles.Add(tile);

                if (x < borderAmount + borderOverlap ||
                    z < borderAmount + borderOverlap ||
                    x >= amountX - borderAmount - borderOverlap ||
                    z >= amountZ - borderAmount - borderOverlap)
                {
                    // Create a duplicate tile that stays fixed in position
                    FogOfWarTile staticTile = new FogOfWarTile();
                    staticTile.position = tile.position;
                    m_staticTiles.Add(staticTile);
                }
            }
        }
    }
    /// <summary>
    /// Creates the fog tile billboards
    /// <param name="width">The width of the game board</param>
    /// <param name="length">The height of the game board</param>
    /// </summary>
    void CreateFogTiles(float width, float length)
    {
        m_fogVelocity.x = 0.5f;
        m_fogVelocity.y = 0.2f;

        const int borderAmount = 4;
        const int borderOverlap = 2;
        int amountX = Mathf.CeilToInt(width / m_fogSize);
        int amountZ = Mathf.CeilToInt(length / m_fogSize);
        amountX += borderAmount * 2;
        amountZ += borderAmount * 2;

        for(int x = 0; x < amountX; ++x)
        {
            for(int z = 0; z < amountZ; ++z)
            {
                FogOfWarTile tile = new FogOfWarTile();

                float randX = UnityEngine.Random.Range(-1.0f, 1.0f);
                float randZ = UnityEngine.Random.Range(-1.0f, 1.0f);

                tile.position = new Vector3(
                    (m_fogSize * ((amountX - 1) * 0.5f)) - (x * m_fogSize) + randX,
                    UnityEngine.Random.Range(5.0f, 15.0f),
                    (m_fogSize * ((amountZ - 1) * 0.5f)) - (z * m_fogSize) + randZ);

                m_activeTiles.Add(tile);

                if (x < borderAmount + borderOverlap ||
                    z < borderAmount + borderOverlap ||
                    x >= amountX - borderAmount - borderOverlap ||
                    z >= amountZ - borderAmount - borderOverlap)
                {
                    // Create a duplicate tile that stays fixed in position
                    FogOfWarTile staticTile = new FogOfWarTile();
                    staticTile.position = tile.position;
                    m_staticTiles.Add(staticTile);
                }
            }
        }
    }
 /// <summary>
 /// Renders a fog tile
 /// <param name="tile">The fog tile to render</param>
 /// </summary>
 void RenderTile(FogOfWarTile tile)
 {
     Graphics.DrawMesh(m_fogTileMesh,
                       tile.position,
                       Camera.main.transform.rotation,
                       m_fogTileMaterial, 0, null, 0,
                       tile.material,
                       false, false);
 }