Hi
This methods plays the sound overlapping(buzzing) and continuous… How can I play the sound one time ?
I think I need to add a timer but couldn’t figure out it…
Thank you if anyone can help…
public class ScoreManager : MonoBehaviour
{
public Text scoreText;
public Text hiScoreText;
public Text Signal;
public float scoreCount;
public float hiScoreCount;
public float pointsPerSecond;
public bool scoreIncreasing;
public AudioManager am;
public AudioSource audiosource;
public AudioClip hi;
void Start()
{
(Signal).enabled = false;
if (PlayerPrefs.HasKey(“BEST”))
//if (PlayerPrefs.GetInt(“BEST”) != null)
{
hiScoreCount = PlayerPrefs.GetFloat(“BEST”);
}
}
void Update()
{
if (scoreIncreasing)
{
scoreCount += pointsPerSecond * Time.deltaTime;
}
if (scoreCount > hiScoreCount)
{
hiScoreCount = scoreCount;
PlayerPrefs.SetFloat(“BEST”, hiScoreCount);
(Signal).enabled = true;
am.highSound.PlayOneShot(hi);
// am.highSound.Play();
}
scoreText.text = "Sea Level : " + Mathf.Round(scoreCount);
hiScoreText.text = "BEST : " + Mathf.Round(hiScoreCount);
}
}