using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class GameEngine : MonoBehaviour
{
    public GameObject currentBlackHole;
    public GameObject currentPlayer;
    public BackgroundMusicManager currentBGMManager;

    //public TMPro.TextMeshProUGUI coreCountText;

    //  might need it for core bar 
   // public coresmeter corebar;
    public HealthBar livesBar;

    public float arenaSize;

    private BlackHoleManager _currentBlackHoleManager;

    // Start is called before the first frame update
    void Awake()
    {        
        // Get the current blackhole so we have easy access to its variables
        _currentBlackHoleManager = currentBlackHole.GetComponent<BlackHoleManager>();        
    }

    private void Start()
    {
        // Make sure godmode is off when starting.
        GameManager.Instance.godMode = false;
        GameManager.Instance.SetupLevel();

        // Start the game, make sure the play GO is active
        currentPlayer.SetActive(true);
        if (currentBGMManager)
        {
            currentBGMManager.StartAudioQueueAndPlay(0);
        }
    }

    /// <summary>
    /// Gets the current blackhole radius 
    /// </summary>
    /// <returns>Current Blackhole size as a float</returns>
    public float GetCurrentBlackHoleRadius()
    {
        return _currentBlackHoleManager.currentBlackHoleRadius;
    }

    // Update is called once per frame
    void Update()
    {
        // Keep the core counter upto date with the current number of cores in the gamemanager
        //coreCountText.text = GameManager.Instance.getCoreCount().ToString();
    
        livesBar.Health(GameManager.Instance.GetLives());
        //corebar.pickupcore(GameManager.Instance.getCoreCount());
    }
}
