//Called whenever the button is pressed. The button can't be pressed if it's locked.
    void ChangeToDifferentSkin()
    {
        if (isLevelTheme)
        {
            Skins.levelTheme = themeToActivate;
            if (themeToActivate != Skins.Themes.RANDOM)
            {
                Skins.randomTheme = false;
            }
        }
        else
        {
            Skins.snakeSkin = skinToActivate;
            if (skinToActivate != Skins.SnakeSkins.RANDOM)
            {
                Skins.randomSkin = false;
            }

            //Change the player skin if not randomizing
            GameObject.Find("Player").GetComponent <Snake>().ChangeSnakeSkin();
        }

        //If random was just picked, then turn random on.
        Skins.CheckForRandomization();


        //Save new skin
        GlobalStats.Save();

        //Force the theme to change
        if (isLevelTheme)
        {
            SceneManager.LoadScene(0);
        }
        else
        {
            //Force out of skin menu
            GlobalStats.hud.ChangeMenuMode(1);
        }
    }
    //Player is about to finish this "level", and the game will generate another one.
    private void OnTriggerEnter(Collider other)
    {
        if (other.name == "Player" && open && !entered)
        {
            if (transform.parent.name != "StartingLevel")
            {
                //Add score depending on what the theme difficulty is
                if (Skins.levelTheme == Skins.Themes.RUINS)
                {
                    GlobalStats.AddScore(150, other.transform.position);
                }
                else if (Skins.levelTheme == Skins.Themes.FACTORY)
                {
                    GlobalStats.AddScore(250, other.transform.position);
                }
                else if (Skins.levelTheme == Skins.Themes.DUNGEON)
                {
                    GlobalStats.AddScore(150, other.transform.position);
                }
                else
                {
                    GlobalStats.AddScore(100, other.transform.position);
                }

                CoinObjective.CheckForObjective((int)CoinObjective.Objective.BEAT_THEMED_LEVELS, (int)Skins.levelTheme);
            }

            //Remove the arrow cube reference if it exists
            GameObject arrowObject = GameObject.Find("CubeArrow");
            if (arrowObject)
            {
                arrowObject.GetComponent <LookAtCube>().RemoveRefernce();
            }

            SoundManager.PlaySound(SoundManager.Sounds.ENTER_GATE);


            //Remove any obstacles so they stop with the damn spike trap sounds :P
            GameObject[] hazardsToKill = GameObject.FindGameObjectsWithTag("BurnableNotSolid");
            for (int i = hazardsToKill.Length - 1; i >= 0; i--)
            {
                Destroy(hazardsToKill[i]);
            }

            //Ranzomide level theme if that is set
            Skins.CheckForRandomization(true);

            Snake snake = other.GetComponent <Snake>();
            snake.IncreaseSpeed();
            snake.lastSpawnPosition = transform.position;

            //Spawn in more level here. Despawn the oldest level, but not the one being exited.
            entered = true;
            LevelSpawner spawner = GameObject.Find("LevelSpawner").GetComponent <LevelSpawner>();
            spawner.EndLevel(transform.position);
        }
        else if (other.tag == "Wall") //Alternatively if a level is spawned in, despawn any walls that would  be in the way of the door.
        {
            Destroy(other.gameObject);
        }

        Debug.Log(other.tag);
    }