From 2691f5734ae3ec0b3ee0844123cf984a3e21247f Mon Sep 17 00:00:00 2001
From: mhz1g21 <mhz1g21@soton.ac.uk>
Date: Mon, 25 Nov 2024 14:59:24 +0000
Subject: [PATCH] scene loads

---
 .../Resources/SteamAudioSettings.asset        |  4 +--
 AVVR/Assets/Scenes/MenuInterface.unity        |  7 +++--
 .../_Scripts/MenuInterface/BuildRoom.cs       | 29 +++++++++++++++++++
 .../ProjectSettings/EditorBuildSettings.asset |  5 +++-
 4 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/AVVR/Assets/Plugins/SteamAudio/Resources/SteamAudioSettings.asset b/AVVR/Assets/Plugins/SteamAudio/Resources/SteamAudioSettings.asset
index 0f7ff53..8671429 100644
--- a/AVVR/Assets/Plugins/SteamAudio/Resources/SteamAudioSettings.asset
+++ b/AVVR/Assets/Plugins/SteamAudio/Resources/SteamAudioSettings.asset
@@ -24,8 +24,8 @@ MonoBehaviour:
     serializedVersion: 2
     m_Bits: 0
   maxOcclusionSamples: 16
-  realTimeRays: 16384
-  realTimeBounces: 16
+  realTimeRays: 32768
+  realTimeBounces: 32
   realTimeDuration: 1
   realTimeAmbisonicOrder: 1
   realTimeMaxSources: 32
diff --git a/AVVR/Assets/Scenes/MenuInterface.unity b/AVVR/Assets/Scenes/MenuInterface.unity
index 2a8c217..b18afe4 100644
--- a/AVVR/Assets/Scenes/MenuInterface.unity
+++ b/AVVR/Assets/Scenes/MenuInterface.unity
@@ -38,7 +38,7 @@ RenderSettings:
   m_ReflectionIntensity: 1
   m_CustomReflection: {fileID: 0}
   m_Sun: {fileID: 0}
-  m_IndirectSpecularColor: {r: 0.18028352, g: 0.22571376, b: 0.30692244, a: 1}
+  m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
   m_UseRadianceAmbientProbe: 0
 --- !u!157 &3
 LightmapSettings:
@@ -1406,6 +1406,7 @@ MonoBehaviour:
   - name: speakers
     inputValidator: {fileID: 8551979803024852529}
   buildButton: {fileID: 1673999060}
+  interactableAudioSourcePrefab: {fileID: 1342686809196105485, guid: e8704b2cb89ef5f4c900ad41600ea441, type: 3}
 --- !u!224 &815677738 stripped
 RectTransform:
   m_CorrespondingSourceObject: {fileID: 7759001298716345201, guid: 2c2e4829725baed4f81fa638908f2e91, type: 3}
@@ -3045,8 +3046,8 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 589.5, y: 0}
-  m_SizeDelta: {x: 1159, y: 0}
+  m_AnchoredPosition: {x: 756, y: 0}
+  m_SizeDelta: {x: 1492, y: 0}
   m_Pivot: {x: 0.5, y: 1}
 --- !u!114 &2044274857
 MonoBehaviour:
diff --git a/AVVR/Assets/_Scripts/MenuInterface/BuildRoom.cs b/AVVR/Assets/_Scripts/MenuInterface/BuildRoom.cs
index 9022161..8099107 100644
--- a/AVVR/Assets/_Scripts/MenuInterface/BuildRoom.cs
+++ b/AVVR/Assets/_Scripts/MenuInterface/BuildRoom.cs
@@ -2,11 +2,14 @@ using System;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
+using UnityEngine.SceneManagement;
 
 public class BuildRoom : MonoBehaviour {
     public LabelledInputValidator[] labelledInputValidators; // All the input validators and their respective labels
     public Button buildButton; // The submit/build room button
 
+    public GameObject interactableAudioSourcePrefab;
+
     void Update() {
         // Check if all inputs have been entered and enable/disable the button
         foreach (LabelledInputValidator labelledInputValidator in labelledInputValidators) {
@@ -61,6 +64,32 @@ public class BuildRoom : MonoBehaviour {
         }
 
         Debug.Log(DictionaryToString(allData));
+
+        // Load the VR prefab scene
+        SceneManager.LoadScene("VRPrefabScene");
+
+        // Extract speaker data from the dictionary
+        if (allData.ContainsKey("speakers"))
+        {
+            Dictionary<string, object> speakers = allData["speakers"] as Dictionary<string, object>;
+            foreach (var speakerEntry in speakers)
+            {
+                Dictionary<string, object> speakerData = speakerEntry.Value as Dictionary<string, object>;
+                float x = float.Parse(speakerData["x"].ToString());
+                float y = float.Parse(speakerData["y"].ToString());
+                float z = float.Parse(speakerData["z"].ToString());
+                string audioPath = speakerData["path"].ToString();
+
+                // Instantiate the speaker prefab
+                GameObject speaker = Instantiate(interactableAudioSourcePrefab, new Vector3(x, y, z), Quaternion.identity);
+
+                // Set the audio clip for the speaker
+                AudioSource audioSource = speaker.GetComponent<AudioSource>();
+                audioSource.clip = Resources.Load<AudioClip>(audioPath);
+            }
+        }
+
+        // TODO: Handle .obj and .mtl files
     }
 
     string DictionaryToString(Dictionary<string, object> dictionary, int depth = 0) {
diff --git a/AVVR/ProjectSettings/EditorBuildSettings.asset b/AVVR/ProjectSettings/EditorBuildSettings.asset
index 6d2a217..b6d8a1c 100644
--- a/AVVR/ProjectSettings/EditorBuildSettings.asset
+++ b/AVVR/ProjectSettings/EditorBuildSettings.asset
@@ -5,9 +5,12 @@ EditorBuildSettings:
   m_ObjectHideFlags: 0
   serializedVersion: 2
   m_Scenes:
-  - enabled: 1
+  - enabled: 0
     path: Assets/Scenes/SampleScene.unity
     guid: 55daccc09a3b69647bbab145b54a3ab3
+  - enabled: 1
+    path: Assets/Scenes/MenuInterface.unity
+    guid: 71ca599599e48294ea268eef3bfef344
   m_configObjects:
     Unity.XR.Oculus.Settings: {fileID: 11400000, guid: bfa1182bd221b4ca89619141f66f1260, type: 2}
     Unity.XR.WindowsMR.Settings: {fileID: 11400000, guid: dc5a169419fa04987b057f65238cf3ba, type: 2}
-- 
GitLab