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

public class SoundController : MonoBehaviour
{
    float player1Count, player2Count;
    AudioSource Rock, Synth;
    private void Start()
    {
        Rock = GameObject.FindGameObjectWithTag("Rock").GetComponent<AudioSource>();
        Synth = GameObject.FindGameObjectWithTag("Synth").GetComponent<AudioSource>();
    }
    // Update is called once per frame
    void Update()
    {
        player1Count = PlayerPrefs.GetFloat("Player1Count");
        player2Count = PlayerPrefs.GetFloat("Player2Count");

        float player1Percentage = player1Count / (player1Count + player2Count);
        float player2Percentage = player2Count / (player2Count + player1Count);

        Rock.volume = player1Percentage * 0.5f;
        Synth.volume = player2Percentage * 0.5f;
    }
}
