Skip to content

Commit 7ded62d

Browse files
Added RobotVoiceController.cs for handling robot voice audio and updated PopUpController.cs by removing unused imports and comments. Also, refactored some comments in ScriptedRobotManager.cs.
Signed-off-by: Donovan Montoya <dmontoya@unity.edu>
1 parent 2fbb386 commit 7ded62d

3 files changed

Lines changed: 32 additions & 8 deletions

File tree

Core/RobotVoiceController.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Collections;
2+
using UnityEngine;
3+
4+
namespace _project.Scripts.Core
5+
{
6+
public class RobotVoiceController : MonoBehaviour
7+
{
8+
[SerializeField] private AudioSource introAudio;
9+
10+
private static void PlayAudio(AudioSource clip) { clip.Play(); }
11+
12+
public IEnumerator PlayIntroAudio()
13+
{
14+
PlayAudio(introAudio);
15+
yield return new WaitForSeconds(introAudio.clip.length);
16+
}
17+
18+
public IEnumerator PlayFailAudio()
19+
{
20+
PlayAudio(introAudio);
21+
yield return new WaitForSeconds(introAudio.clip.length);
22+
}
23+
}
24+
}

Core/ScriptedRobotManager.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private bool Validate()
9898
// Get the value of the field
9999
var value = field.GetValue(this);
100100

101-
// Check if the value is null or, for Unity objects, if it is missing
101+
// Check if the value is null or, for Unity objects if it is missing
102102
if (value != null && (value is not Object unityObject || unityObject)) continue;
103103
Debug.LogError($"Field '{field.Name}' is null or missing!");
104104
return false;
@@ -168,12 +168,12 @@ private IEnumerator StageTwoScript()
168168
// ReSharper disable Unity.PerformanceAnalysis
169169
private IEnumerator StageThreeScript()
170170
{
171-
// Player should open the notebook, Wait for flag to continue
171+
// Player should open the notebook, Wait for a flag to continue
172172
yield return new WaitUntil(() => _flags.Contains(ScriptFlags.Inspected));
173173
if (debugging) Debug.Log("Inspected Object");
174174
SetDialogueText(3, 1);
175175

176-
// Player should open the notebook, Wait for flag to continue
176+
// Player should open the notebook, Wait for a flag to continue
177177
yield return new WaitUntil(() => _flags.Contains(ScriptFlags.OpenedNotebook));
178178
if (debugging) Debug.Log("Opened Notebook");
179179
SetDialogueText(4, 1);
@@ -183,7 +183,7 @@ private IEnumerator StageThreeScript()
183183
if (debugging) Debug.Log("Picture Taken");
184184
SetDialogueText(5, 1);
185185

186-
// Robot will tell the player to open the gallery and take a look
186+
// The Robot will tell the player to open the gallery and take a look
187187
yield return new WaitUntil(() => _flags.Contains(ScriptFlags.OpenedGallery));
188188
if (debugging) Debug.Log("Opened Gallery");
189189
SetDialogueText(6, 1);
@@ -198,7 +198,7 @@ private IEnumerator StageFourScript()
198198
{
199199
robotController.SetNewFocusTarget(player);
200200
robotController.GoToNewLocation(playerFront.transform.position);
201-
// play some audio about the plants
201+
// play some audio about the plant
202202
//yield return new WaitForSeconds(dlg1.length);
203203
yield return new WaitForSeconds(1);
204204
//TEMP

UI/PopUpController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Collections;
21
using _project.Scripts.Card_Core;
32
using TMPro;
43
using UnityEngine;
@@ -14,7 +13,7 @@ public class PopUpController : MonoBehaviour
1413
[SerializeField] private TextMeshProUGUI popUpText;
1514
[SerializeField] private Button closeButton;
1615

17-
// Testing
16+
/*
1817
private void Start() { StartCoroutine(DelayedStart()); }
1918
2019
private IEnumerator DelayedStart()
@@ -23,7 +22,8 @@ private IEnumerator DelayedStart()
2322
ToggleUiInput();
2423
Click3D.click3DGloballyDisabled = true;
2524
}
26-
25+
*/
26+
2727
private void ActivatePopUpPanel(Image image, string text)
2828
{
2929
if (popUpPanel.activeInHierarchy) return;

0 commit comments

Comments
 (0)