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

/**
* Noora Jokela
*/

public class Points : MonoBehaviour
{

    private int _playerScore = 0;
    private PointAudioHandler _audioHandler;
	public TextMeshProUGUI scoreText;


    void Start()
    {
        _audioHandler = GetComponent<PointAudioHandler>();
        SetScoreText();
        
    StartCoroutine(count());
    }

    void SetScoreText(){
        scoreText.text =  "Score: " + _playerScore.ToString();
    }

    void Update()
    {
        
    }

    private IEnumerator count()
{
    yield return new WaitForSeconds(1f);    
        UpScore();

    StartCoroutine(count());
}

    void UpScore(){
            _playerScore++;
            Pistehet.pisteet++;
            SetScoreText();
            //_audioHandler.PlayPointSound();

    }
}

public static class Pistehet{
    public static int pisteet;
    public static int[] highSchores = new int[5];
}
