-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathPlayerVoip.cs
More file actions
34 lines (30 loc) · 1.06 KB
/
PlayerVoip.cs
File metadata and controls
34 lines (30 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) Meta Platforms, Inc. and affiliates.
// Use of the material below is subject to the terms of the MIT License
// https://github.com/oculus-samples/Unity-Decommissioned/tree/main/Assets/Decommissioned/LICENSE
using Meta.Multiplayer.Core;
using Meta.Utilities;
using Meta.XR.Samples;
using Photon.Voice.Unity;
using Unity.Netcode;
using UnityEngine;
namespace Meta.Decommissioned.Player
{
/// <summary>
/// Manages user voice chat; allows us to retrieve and set the state (mute / unmute) of voice for
/// the receiving player(s).
/// </summary>
[MetaCodeSample("Decommissioned")]
public class PlayerVoip : Multiton<PlayerVoip>
{
[SerializeField, AutoSet] protected Speaker m_voipSpeaker;
[SerializeField, AutoSet] protected AudioSource m_voipAudio;
public NetworkObject NetworkObject => VoipController.Instance.GetPlayer(m_voipSpeaker);
public void SetMuted(bool mute)
{
if (m_voipAudio != null)
{
m_voipAudio.mute = mute;
}
}
}
}