public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        RandomMapGen levelGen = (RandomMapGen)target;


        //Only show the mapsettings UI if we have a reference set up in the editor

        {
            //Editor mapSettingEditor = CreateEditor(levelGen.mapSetting);
            // mapSettingEditor.OnInspectorGUI();

            if (GUILayout.Button("Generate"))
            {
                //

                /*
                 * levelGen.CreateMap();
                 * levelGen.GenerateMap();
                 */

                /*
                 * levelGen.ver_size();
                 * levelGen.hor_size();*/
                /*
                 *              levelGen.PCG();
                 *              levelGen.addGaps();
                 *              levelGen.hor_size();
                 *              levelGen.GenerateMap();
                 */


                levelGen.CreateSpawnMap();
                levelGen.SpawnObjects();
            }

            if (GUILayout.Button("Clear"))
            {
                //levelGen.clearMap();
            }
        }
    }
    /* private void Update()
     * {
     *   int randEnemy = Random.Range(0, enemyPrefabs.Length);
     *   int randSpawnPoint = Random.Range(0, spawnPoints.Length);
     *   if (count < 5)
     *   {
     *
     *       Instantiate(enemyPrefabs[randEnemy], spawnPoints[randSpawnPoint].position, transform.rotation);
     *
     *   }
     *   count++;
     * }*/

    public void SpawnRandomEnemies()
    {
        go = GameObject.Find("MapGen");
        RandomMapGen rnd = go.GetComponent <RandomMapGen>();

        width = rnd.width;

        height = rnd.SpawnHeight;

        Enemy_count = 8; //just for initial runs;
        if (rnd.score > 4500)
        {
            Enemy_count = 16;//increasing enemies in case of player's performance
        }
        if (rnd.score > 12000)
        {
            Enemy_count = 20;//increasing enemies in case of player's performance
            if (Enemy_count > (width / 3 + 5))
            {
                Enemy_count = 20;
            }
        }
        int[] mapping = new int[rnd.width];
        //the basic idea to use it to ensure not any two enemies reside over each other.

        enemyPrefabs    = new GameObject[3]; //currently storing only 3 enemy types;
        enemyPrefabs[0] = Resources.Load("Enemies/Brown Goomba") as GameObject;
        enemyPrefabs[1] = (Resources.Load("Enemies/Green Koopa")) as GameObject;
        enemyPrefabs[2] = (Resources.Load("Enemies/Red Winged Koopa")) as GameObject;

        Vector2 spawnPos; //to store the spawning position


        while (Enemy_count > 0)
        {
            int rand_val = UnityEngine.Random.Range(15, width - 1);
            if (mapping[rand_val] == 0)
            {
                int selectEnemy = 0;
                if (rnd.score > 10000)
                {
                    selectEnemy = UnityEngine.Random.Range(1, 3);
                }
                else if (rnd.score > 1000)
                {
                    selectEnemy = UnityEngine.Random.Range(1, 2);
                }
                else if (rnd.score < 500)
                {
                    selectEnemy = UnityEngine.Random.Range(0, 1);
                }

                spawnPos = new Vector2(rand_val, height);
                if (selectEnemy == 0)
                {
                    Instantiate(enemyPrefabs[0], spawnPos, transform.rotation);
                }
                if (selectEnemy == 1)
                {
                    Instantiate(enemyPrefabs[1], spawnPos, transform.rotation);
                }
                if (selectEnemy == 2)
                {
                    Instantiate(enemyPrefabs[2], spawnPos, transform.rotation);
                }

                mapping[rand_val] = 1;
                Enemy_count--;
            }
        }
    }