using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;

public class ScoreboardRenderer : MonoBehaviour
{
    public CollectiblesTracker tracker;

    public TextMeshPro displayPercent;
    public TextMeshPro displayEasy;
    public TextMeshPro displayNormal;
    public TextMeshPro displayHard;

    public TextMeshPro displayTimes;

    // Update is called once per frame
    void Update()
    {
        // Counts
        displayEasy.text = tracker.foundEasy+"/"+tracker.totalEasy;
        displayNormal.text = tracker.foundMedium+"/"+tracker.totalMedium;
        displayHard.text = tracker.foundHard+"/"+tracker.totalHard;

        // Times
        displayTimes.text = "Time to first complete: "+tracker.GetCompleteTime()+"\nTime to 100%  complete: "+tracker.GetFullCompleteTime();

        // Calculate percent completed
        float percent = ((float)tracker.foundEasy+tracker.foundMedium+tracker.foundHard) / (tracker.totalEasy + tracker.totalMedium + tracker.totalHard);
        int percentScore = Mathf.FloorToInt(percent*100);
        displayPercent.text = "Total: "+percentScore+"%";
    }
}
