using UnityEngine;
using UnityEngine.UI;

public class Orb : MonoBehaviour
{
    private GameObject miniMapCamera;

    private void Awake()
    {
        Canvas canvas = GetComponentInChildren<Canvas>();
        if(miniMapCamera == null)
        {
            miniMapCamera = GameObject.Find("MiniMapCamera");
        }

        if(canvas && canvas.renderMode == RenderMode.WorldSpace)
        {

            canvas.worldCamera = miniMapCamera.GetComponent<Camera>();
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        if(other.gameObject.name == "Player")
        {
            Debug.Log("Player collected an orb");
            GameManager.gameManagerInstance.IncreaseOrbCounter();
            Destroy(gameObject);
        }
    }
}
