/*
     * -------------------------------------------------------------------------
     * MARK: LIFECYCLE FUNCTIONS
     * -------------------------------------------------------------------------
     */

    void Awake()
    {
        terrainController = GameObject.FindGameObjectWithTag("Terrain").GetComponent <TerrainController>();
        GameObject[] groundTiles = GameObject.FindGameObjectsWithTag("Ground Tile");
        tileRenderers = groundTiles.Select((tile) => tile.GetComponent <Renderer>())
                        .Cast <Renderer>()
                        .ToArray();
        tileControllers = groundTiles.Select((tile) => tile.GetComponent <GroundTileController>())
                          .Cast <GroundTileController>()
                          .ToArray();

        foreach (GameObject tile in groundTiles)
        {
            if (tile.transform.position.x + 1 > gridSizeX)
            {
                gridSizeX = (int)tile.transform.position.x + 1;
            }
            if (tile.transform.position.z + 1 > gridSizeZ)
            {
                gridSizeZ = (int)tile.transform.position.z + 1;
            }
        }

        groundHashtable = new GroundHashtable(this);
        groundGraph     = new GroundGraph(this);
        groundGraph.ConstructGraph();
    }