コード例 #1
0
    public void InitPlayerVolumes()
    {
        playerVolumesList.DestroyChildren();

        foreach (PlayableCharacter player in FindObjectsOfType <PlayableCharacter>())
        {
            if (!player.IsMe())
            {
                GameObject item = Instantiate(playerVolumeItem, playerVolumesList.transform);
                foreach (Image image in item.GetComponentsInChildren <Image>())
                {
                    image.color = player.playerInfo.color;
                }

                Slider slider = item.GetComponentInChildren <Slider>();
                slider.onValueChanged.AddListener(delegate {
                    webRTC.SetVolume(player.Owner.ActorNumber, slider.value);
                    Debug.Log("Slider value being set");
                    Debug.Log(slider.value);
                });
                slider.value = webRTC.GetVolume(player.Owner.ActorNumber);
                Debug.Log(webRTC.GetVolume(player.Owner.ActorNumber));
            }
        }
    }