// Use this for initialization
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
            tilePool = GameObject.FindGameObjectWithTag("EventSystem").GetComponent <TilePool>();

            GenerationMap = this.gameObject.AddComponent <GameMap>();
            GenerationMap.AttachMapGameObject();

            forestGenerator = this.gameObject.GetComponent <ForestGenerator>();
            GenerationMap.AttachForestGenerator(forestGenerator);

            GenerationMap.AttachTiles();

            CreatePaths.AttachMap(GenerationMap);
            CreatePaths.AttachTiles(GetCurrentBiomeTileSet().Road, GetCurrentBiomeTileSet().Shallows, GetCurrentBiomeTileSet().Water);

            displaySelected = canvas.GetComponent <DisplaySelected>();
        }
        else
        {
            instance.tilePool = this.gameObject.GetComponent <TilePool>();
            instance.canvas   = GameObject.FindGameObjectWithTag("Canvas").GetComponent <Canvas>();
            Destroy(this);
        }


        gamePlayCam         = cam1.GetComponent <Camera>();
        gamePlayCam.enabled = true;
        topDownCam          = cam2.GetComponent <Camera>();
        topDownCam.enabled  = false;

        testingPhaseCanvas.enabled = false;
    }
    public void StartGenerationProcess()
    {
        if (Height <= 0 || Width <= 0)
        {
            //EditorUtility.DisplayDialog("Empty Map", "The height and/or width = 0", "Coolio");
            return;
        }
        GenerationMap.AttachTiles();
        CreatePaths.AttachTiles(GetCurrentBiomeTileSet().Road, GetCurrentBiomeTileSet().Shallows, GetCurrentBiomeTileSet().Water);

        //Reset map
        GenerationMap.CreateEmptyMap(Width);
        forestGenerator.ResetTrees();

        switch (SelectedMapTypeX)
        {
        case MapTypeX.Plains:
            GeneratePlains();
            break;

        case MapTypeX.Costal:
            GenerateCostal();
            break;

        case MapTypeX.Islands:
            GenerateIslands();
            break;

        default:
            GeneratePlains();
            break;
        }



        //RandomTilesMap rtm = new RandomTilesMap();
        //rtm.GenerateRandomTileMap(GenerationMap, tilePool.GetTileSetFromBiomeType(SelectedMapType));

        //CreateNoiseBlob.CreateBlobAtPosition(GenerationMap, new MapPoint(30, 30),2, tilePool.GetWaterTile());

        //forestGenerator.AddTreeToMap(new MapPoint(10, 10));
        //forestGenerator.CreateTreeBlobAtPosition(GenerationMap, new MapPoint(24, 24), 2);

        GenerationMap.ApplySandNextToWater();
        GenerationMap.GenerateMap();

        MoveGamePlayCam();
    }