/// <summary>
    /// Called when the player escapes the battle.
    /// </summary>
    public void EscapeBattleButton()
    {
        paused.value = true;
        buttonClickedEvent.Invoke();
        escapeText.gameObject.SetActive(true);

        ScoreScreenValues values = GetComponent <ScoreScreenValues>();

        values.wonBattleState.value = "escape";
        values.time.value           = currentTime;
        values.noEnemies.value      = enemyController.numberOfEnemies;

        StartCoroutine(GoToScoreScreen(battleEndDelay.value));
    }
    public IEnumerator LostBattle(float time)
    {
        winText.text = "YOU DIED";

        ScoreScreenValues values = GetComponent <ScoreScreenValues>();

        values.wonBattleState.value = "lose";
        values.time.value           = currentTime;

        yield return(new WaitForSeconds(time));

        currentArea.value = (int)Constants.SCENE_INDEXES.SCORE;
        SceneManager.LoadScene(currentArea.value);
        yield return(0);
    }
    /// <summary>
    /// Called when it's game over.
    /// </summary>
    public void GameOverTrigger()
    {
        paused.value = true;
        winText.text = "YOU DIED";

        currentMusic.value = null;
        playMusicEvent.Invoke();
        currentSfx.value.Enqueue(diedClip.clip);
        playSfxEvent.Invoke();

        ScoreScreenValues values = GetComponent <ScoreScreenValues>();

        values.wonBattleState.value = "lose";
        values.time.value           = currentTime;

        StartCoroutine(GoToScoreScreen(battleEndDelay.value));
    }
    /// <summary>
    /// Called when the battle is won.
    /// </summary>
    public void WonBattle()
    {
        paused.value = true;
        winText.text = "YOU WIN";

        ScoreScreenValues values = GetComponent <ScoreScreenValues>();

        values.wonBattleState.value = "win";
        values.time.value           = currentTime;
        values.noEnemies.value      = enemyController.numberOfEnemies;
        // values.enemiesDefeated = enemyController.GetEnemiesDefeated();
        values.exp.value   = enemyController.GetTotalExp();
        values.money.value = enemyController.GetTotalMoney();
        // values.treasures = enemyController.GetTreasures();

        StartCoroutine(GoToScoreScreen(battleEndDelay.value));
    }
    public IEnumerator EscapedBattle(float time)
    {
        ScoreScreenValues values = GetComponent <ScoreScreenValues>();

        values.wonBattleState.value = "escape";
        values.time.value           = currentTime;
        values.noEnemies.value      = enemyController.numberOfEnemies;

        Debug.Log("Escaped battle");

        winText.text = "ESCAPED!";
        yield return(new WaitForSeconds(time));

        currentArea.value = (int)Constants.SCENE_INDEXES.SCORE;
        SceneManager.LoadScene(currentArea.value);
        yield return(0);
    }
    public IEnumerator WonBattle(float time)
    {
        ScoreScreenValues values = GetComponent <ScoreScreenValues>();

        values.wonBattleState.value = "win";
        values.time.value           = currentTime;
        values.noEnemies.value      = enemyController.numberOfEnemies;
        // values.enemiesDefeated = enemyController.GetEnemiesDefeated();
        values.exp.value   = enemyController.GetTotalExp();
        values.money.value = enemyController.GetTotalMoney();
        // values.treasures = enemyController.GetTreasures();

        if (be.playerArea == Constants.OverworldArea.TOWER)
        {
            saveGameEvent.Invoke();
        }

        Debug.Log("Won");

        yield return(new WaitForSeconds(time));

        currentArea.value = (int)Constants.SCENE_INDEXES.SCORE;
        SceneManager.LoadScene(currentArea.value);
    }