void PlayClipFromSelection(int myClipIndex, int theirClipIndex, int globalClipIndex, int shoutTagInt, int driverId, int gunnerId, bool playGlobal) { AnnouncerClipsToPlay clipsToPlay = GetAnnouncerClipsToPlay((AnnouncerShoutsTags)shoutTagInt); // we got clips to play if (!playGlobal) { if ((PhotonNetwork.LocalPlayer.ActorNumber == driverId || PhotonNetwork.LocalPlayer.ActorNumber == gunnerId)) { // PlaySound(clipsToPlay.localClips[myClipIndex]); if (!announcerAudioSource.isPlaying) { announcerAudioSource.PlayOneShot(clipsToPlay.localClips[myClipIndex]); } } else { // PlaySound(clipsToPlay.otherClips[theirClipIndex]); if (!announcerAudioSource.isPlaying) { announcerAudioSource.PlayOneShot(clipsToPlay.otherClips[theirClipIndex]); } } } else { // PlaySound(clipsToPlay.globalClips[globalClipIndex]); if (!announcerAudioSource.isPlaying) { announcerAudioSource.PlayOneShot(clipsToPlay.globalClips[globalClipIndex]); } } }
public void PlayAnnouncerLine(AnnouncerClipsToPlay clipSelection) { // return; AnnouncerShoutsTags shoutTag = GetShoutTag(clipSelection); int myClipIndex = -1; int theirClipIndex = -1; int globalClipIndex = -1; if (clipSelection.localClips.Count > 0) { myClipIndex = UnityEngine.Random.Range(0, clipSelection.localClips.Count); } if (clipSelection.otherClips.Count > 0) { theirClipIndex = UnityEngine.Random.Range(0, clipSelection.otherClips.Count); } if (clipSelection.globalClips.Count > 0) { globalClipIndex = UnityEngine.Random.Range(0, clipSelection.globalClips.Count); } bool playGlobal = false; if (myClipIndex < 0 || theirClipIndex < 0) { playGlobal = true; } GetComponent <PhotonView>().RPC(nameof(PlayClipFromSelection), RpcTarget.All, myClipIndex, theirClipIndex, globalClipIndex, (int)shoutTag, 0, 0, playGlobal); }
AnnouncerShoutsTags GetShoutTag(AnnouncerClipsToPlay clipSelection) { return(clipSelection.announcerShoutsTag); }