Пример #1
0
        protected override void _Update()
        {
            if (Game.IsHost || !SteamUser.VoiceRecord)
            {
                return;
            }

            _readTime -= UnityEngine.Time.deltaTime;
            if (_readTime > 0)
            {
                return;
            }

            _readTime = _audioReadTime;

            var data = SteamUser.ReadVoiceDataBytes();

            if (data != null && data.Length > 0)
            {
                var voicePacket = PacketUtility.TakePacket <CompressedVoiceData>();
                voicePacket.ClientIndex = Game.ClientIndex;
                voicePacket.SetData(data, data.Length);
                Client.GameClient.Instance.Socket.BroadcastPacket(voicePacket);
            }
        }