Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain rail on first collision #63

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion Assets/PantoScripts/RailPolyline.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;
using System.Threading.Tasks;
using DualPantoFramework;
namespace UnityEngine
{
Expand Down Expand Up @@ -58,15 +60,46 @@ private void Start()
audioSource.volume = 0;
}

private void OnTriggerEnter(Collider other)
async private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
Debug.Log("fade target");
PantoManager pantoManager = GameObject.Find("PantoManager").GetComponent<PantoManager>();
if (!pantoManager.hasEncounteredRail){
await IntroduceRailAsync(pantoManager);
}
//audioSource.Play();
fadeTarget = 1;
}
}

private async System.Threading.Tasks.Task IntroduceRailAsync(PantoManager pantoManager)
{
pantoManager.SetPaused(true);
pantoManager.upper.Freeze();
pantoManager.lower.Freeze();

Debug.Log("introducing rail");
pantoManager.hasEncounteredRail = true;
AudioSource railAudio = gameObject.AddComponent<AudioSource>();
railAudio.clip = Resources.Load<AudioClip>("Sounds/Speech/Rails");

AudioSource dingAudioSource = gameObject.AddComponent<AudioSource>();
dingAudioSource.clip = Resources.Load<AudioClip>("Sounds/IntroSound2");
dingAudioSource.PlayOneShot(dingAudioSource.clip);
await Task.Delay((int)dingAudioSource.clip.length * 1000);
railAudio.Play();
while(railAudio.isPlaying){
await Task.Delay(10);
}

dingAudioSource.PlayOneShot(dingAudioSource.clip);
await Task.Delay((int)dingAudioSource.clip.length * 1000);
pantoManager.SetPaused(false);

}

private void OnTriggerExit(Collider other)
{
if (other.CompareTag("Player"))
Expand Down
2 changes: 1 addition & 1 deletion Assets/SpeechIOForUnity
Submodule SpeechIOForUnity updated 24 files
+0 −0 Assets/Scenes/2-1 Basic Speech Out Example.unity
+0 −0 Assets/Scenes/2-1 Basic Speech Out Example.unity.meta
+343 −0 Assets/Scenes/2-2 Cancelling Speech Out.unity
+7 −0 Assets/Scenes/2-2 Cancelling Speech Out.unity.meta
+10 −7 Assets/Scripts/DialogGraph Core Scripts/DialogGraph.cs
+39 −0 Assets/Scripts/Example Speech Scripts/MyCancellableSpeechOutScript.cs
+11 −0 Assets/Scripts/Example Speech Scripts/MyCancellableSpeechOutScript.cs.meta
+14 −9 Assets/Scripts/Example Speech Scripts/MyCustomSpeechScript.cs
+21 −16 Assets/Scripts/Example Speech Scripts/MyRockPaperScissorsScript.cs
+9 −6 Assets/Scripts/Example Speech Scripts/MySpeechInScript.cs
+5 −3 Assets/Scripts/Example Speech Scripts/MySpeechOutScript.cs
+40 −0 Assets/Scripts/Speech Input Core Scripts/LinuxSpeechIn.cs
+11 −0 Assets/Scripts/Speech Input Core Scripts/LinuxSpeechIn.cs.meta
+1 −1 Assets/Scripts/Speech Input Core Scripts/MacOSSpeechIn.cs
+33 −22 Assets/Scripts/Speech Input Core Scripts/SpeechIn.cs
+7 −5 Assets/Scripts/Speech Input Core Scripts/VoiceCommandBase.cs
+35 −22 Assets/Scripts/Speech Input Core Scripts/WindowsSpeechIn.cs
+34 −0 Assets/Scripts/Speech Output Core Scripts/LinuxSpeechOut.cs
+11 −0 Assets/Scripts/Speech Output Core Scripts/LinuxSpeechOut.cs.meta
+10 −6 Assets/Scripts/Speech Output Core Scripts/MacOSSpeechOut.cs
+2 −2 Assets/Scripts/Speech Output Core Scripts/SpeechBase.cs
+13 −4 Assets/Scripts/Speech Output Core Scripts/SpeechOut.cs
+78 −67 Assets/Scripts/Speech Output Core Scripts/WindowsSpeechOut.cs
+3 −2 README.md