diff --git a/Assets/SharedSpatialAnchors/Prefabs/Resources/TalkingAvatar.prefab b/Assets/SharedSpatialAnchors/Prefabs/Resources/TalkingAvatar.prefab index 3ecd6a0..16b247f 100644 --- a/Assets/SharedSpatialAnchors/Prefabs/Resources/TalkingAvatar.prefab +++ b/Assets/SharedSpatialAnchors/Prefabs/Resources/TalkingAvatar.prefab @@ -946,9 +946,11 @@ GameObject: - component: {fileID: 3196596099490932396} - component: {fileID: 4067417591161320129} - component: {fileID: 3569971862085791352} + - component: {fileID: 1553315533} + - component: {fileID: 1553315532} m_Layer: 0 m_Name: TalkingAvatar - m_TagString: Untagged + m_TagString: Avatar m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 @@ -962,7 +964,7 @@ Transform: m_GameObject: {fileID: 3128949758138181256} m_LocalRotation: {x: 0, y: 1, z: 0, w: 0} m_LocalPosition: {x: 1.42, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1.3, z: 1.3} + m_LocalScale: {x: 1.25, y: 1.3, z: 1.3} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 5280034911807405635} @@ -1063,6 +1065,116 @@ MonoBehaviour: m_SynchronizeAngularVelocity: 1 m_TeleportEnabled: 1 m_TeleportIfDistanceGreaterThan: 3 +--- !u!82 &1553315533 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3128949758138181256} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: d04b5fce2c9627f4483faa6f2951f454, type: 3} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 +--- !u!114 &1553315532 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3128949758138181256} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: df56a8fa2ce0307498969d4c550617b5, type: 3} + m_Name: + m_EditorClassIdentifier: + audioNarration_1: {fileID: 8300000, guid: d04b5fce2c9627f4483faa6f2951f454, type: 3} + audioNarration_2: {fileID: 8300000, guid: 9b80a823b03707d42a56551b996ed9be, type: 3} --- !u!1 &3489539847802727250 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/SharedSpatialAnchors/Scripts/API.cs b/Assets/SharedSpatialAnchors/Scripts/API.cs index 34272ba..c15d0e3 100644 --- a/Assets/SharedSpatialAnchors/Scripts/API.cs +++ b/Assets/SharedSpatialAnchors/Scripts/API.cs @@ -52,6 +52,8 @@ public class API : MonoBehaviour private WebSocketController webSocketControllerScript; public bool isButtonPressed = false; // Boolean to keep voltage updated as long as the turbine is rotating PhotonView photonView; + private GameObject avatar; + private AudioController audioControllerScript; void Start() @@ -79,6 +81,11 @@ public class API : MonoBehaviour webSocketController = GameObject.FindGameObjectWithTag("WebController"); webSocketControllerScript = webSocketController.GetComponent<WebSocketController>(); StartCoroutine(GetText()); + + avatar = GameObject.FindGameObjectWithTag("Avatar"); + audioControllerScript = avatar.GetComponent<AudioController>(); + audioControllerScript.fn_call_AudioNarration2(); + } [PunRPC] diff --git a/Assets/SharedSpatialAnchors/Scripts/AudioController.cs b/Assets/SharedSpatialAnchors/Scripts/AudioController.cs new file mode 100644 index 0000000..fef184d --- /dev/null +++ b/Assets/SharedSpatialAnchors/Scripts/AudioController.cs @@ -0,0 +1,63 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Photon.Pun; + +public class AudioController : MonoBehaviour +{ + AudioSource audioSource; + public AudioClip audioNarration_1; + public AudioClip audioNarration_2; + PhotonView photonView; + + // Start is called before the first frame update + void Start() + { + audioSource = GetComponent<AudioSource>(); + } + + public void Update() + { + + } + + // Audio Narration 1 + public void fn_call_AudioNarration1() + { + photonView = PhotonView.Get(this); + photonView.RPC("RPC_startAudioNarration1", RpcTarget.All); + } + + [PunRPC] + public void RPC_startAudioNarration1() + { + StartCoroutine(CoRoutine_startAudioNarration1()); + } + IEnumerator CoRoutine_startAudioNarration1() + { + yield return new WaitForSeconds(1.0f); + audioSource.PlayOneShot(audioNarration_1); + } + + // Audio Narration 2 + public void fn_call_AudioNarration2() + { + photonView = PhotonView.Get(this); + photonView.RPC("RPC_startAudioNarration2", RpcTarget.All); + } + + [PunRPC] + public void RPC_startAudioNarration2() + { + StartCoroutine(CoRoutine_startAudioNarration2()); + } + IEnumerator CoRoutine_startAudioNarration2() + { + yield return new WaitForSeconds(0.0f); + audioSource.PlayOneShot(audioNarration_2); + } + + + + +} diff --git a/Assets/SharedSpatialAnchors/Scripts/AudioController.cs.meta b/Assets/SharedSpatialAnchors/Scripts/AudioController.cs.meta new file mode 100644 index 0000000..edc54c9 --- /dev/null +++ b/Assets/SharedSpatialAnchors/Scripts/AudioController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: df56a8fa2ce0307498969d4c550617b5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/SharedSpatialAnchors/Scripts/SharedAnchorControlPanel.cs b/Assets/SharedSpatialAnchors/Scripts/SharedAnchorControlPanel.cs index 2f961db..a7cbdb0 100644 --- a/Assets/SharedSpatialAnchors/Scripts/SharedAnchorControlPanel.cs +++ b/Assets/SharedSpatialAnchors/Scripts/SharedAnchorControlPanel.cs @@ -386,5 +386,7 @@ public class SharedAnchorControlPanel : MonoBehaviour var networkedAvatar = PhotonPun.PhotonNetwork.Instantiate(TwinTurbine_talkingAvatar.name, new Vector3(1f, -0.2f, 1.15f), Quaternion.Euler(Vector3.up * 120)); var photonGrabbableAvatar = networkedAvatar.GetComponent<PhotonGrabbableObject>(); + + } } diff --git a/Assets/ThirdParty/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset b/Assets/ThirdParty/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset index a1ce2f5..1a369c3 100644 --- a/Assets/ThirdParty/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset +++ b/Assets/ThirdParty/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset @@ -53,6 +53,8 @@ MonoBehaviour: - RPC_GreenButtonClick - RPC_VoltageUpdate - RPC_WT_Turn + - RPC_startAudioNarration1 + - RPC_startAudioNarration2 DisableAutoOpenWizard: 1 ShowSettings: 1 DevRegionSetOnce: 1 diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 440f9a8..81a67a0 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -7,6 +7,7 @@ TagManager: - WebController - WindTurbine - GUIData + - Avatar layers: - Default - TransparentFX