// ----------------------------------------------------------------------------
//
// Photon Voice Demo for PUN- Copyright (C) 2016 Exit Games GmbH
//
//
// Class that highlights the Photon Voice features by toggling isometric view
// icons for the two components Recorder and Speaker.
//
// developer@photonengine.com
// ----------------------------------------------------------------------------
#pragma warning disable 0649 // Field is never assigned to, and will always have its default value
namespace ExitGames.Demos.DemoPunVoice
{
using UnityEngine;
using UnityEngine.UI;
using Photon.Voice.Unity;
using Photon.Voice.PUN;
[RequireComponent(typeof(Canvas))]
public class Highlighter : MonoBehaviour
{
private Canvas canvas;
private PhotonVoiceView photonVoiceView;
[SerializeField]
private Image recorderSprite;
[SerializeField]
private Image speakerSprite;
[SerializeField]
private Text bufferLagText;
private bool showSpeakerLag;
private void OnEnable()
{
ChangePOV.CameraChanged += this.ChangePOV_CameraChanged;
VoiceDemoUI.DebugToggled += this.VoiceDemoUI_DebugToggled;
}
private void OnDisable()
{
ChangePOV.CameraChanged -= this.ChangePOV_CameraChanged;
VoiceDemoUI.DebugToggled -= this.VoiceDemoUI_DebugToggled;
}
private void VoiceDemoUI_DebugToggled(bool debugMode)
{
this.showSpeakerLag = debugMode;
}
private void ChangePOV_CameraChanged(Camera camera)
{
this.canvas.worldCamera = camera;
}
private void Awake()
{
this.canvas = this.GetComponent