Commit 967584a7 authored by radow's avatar radow

Golden path Voices in game

parent fca7f24d
......@@ -6,6 +6,7 @@ public class POITrigger : MonoBehaviour {
public GameObject[] toActivate;
public GameObject[] toDeactivate;
public string[] textToDisplay;
public AudioClip[] VAToHEar;
Collider coll;
POIRotator effect;
......@@ -15,7 +16,7 @@ public class POITrigger : MonoBehaviour {
}
private void OnTriggerEnter(Collider other) {
TextDisplay.ShowText(textToDisplay);
TextDisplay.ShowText(textToDisplay, VAToHEar);
foreach (var obj in toActivate) {
obj.SetActive(true);
}
......
......@@ -10,6 +10,8 @@ public class TextDisplay : MonoBehaviour {
GameObject panel;
GameObject skip;
string[] lines;
AudioClip[] VAlines;
AudioSource auds;
float showSkip = 0;
......@@ -19,6 +21,7 @@ public class TextDisplay : MonoBehaviour {
skip = transform.Find("Panel/Skip").gameObject;
panel.SetActive(false);
instance = this;
auds = GetComponent<AudioSource>();
}
private void Update() {
......@@ -30,9 +33,11 @@ public class TextDisplay : MonoBehaviour {
}
}
public static void ShowText(string[] toShow) {
public static void ShowText(string[] toShow, AudioClip[] toHear) {
instance.lines = toShow;
instance.VAlines = toHear;
instance.NextLine();
}
private void NextLine() {
......@@ -41,10 +46,13 @@ public class TextDisplay : MonoBehaviour {
return;
}
text.text = lines[0];
auds.clip = VAlines[0];
auds.Play();
panel.SetActive(true);
skip.SetActive(false);
showSkip = Time.time + 1f;
lines = lines.Skip(1).ToArray();
VAlines = VAlines.Skip(1).ToArray();
}
}
fileFormatVersion: 2
guid: adf4bba33e2644447b016784b62e8654
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 105758ea38dca4e42baba16a00477206
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment