Browse Source

Added voiceover support for Say and Choose commands

master
chrisgregan 10 years ago
parent
commit
afb3620f12
  1. 6
      Assets/Fungus/Dialog/Commands/Choose.cs
  2. 6
      Assets/Fungus/Dialog/Commands/Say.cs
  3. 6
      Assets/Fungus/Dialog/Editor/ChooseEditor.cs
  4. 6
      Assets/Fungus/Dialog/Editor/SayEditor.cs
  5. BIN
      Assets/Shuttle/Destiny.mp3
  6. 12
      Assets/Shuttle/Destiny.mp3.meta
  7. BIN
      Assets/Shuttle/ShuttleGame.unity
  8. BIN
      Assets/Shuttle/Welcome.mp3
  9. 12
      Assets/Shuttle/Welcome.mp3.meta

6
Assets/Fungus/Dialog/Commands/Choose.cs

@ -22,6 +22,7 @@ namespace Fungus.Script
public string chooseText;
public Character character;
public AudioClip voiceOverClip;
public float timeoutDuration;
bool showBasicGUI;
@ -81,6 +82,11 @@ namespace Fungus.Script
options.Clear();
if (voiceOverClip != null)
{
MusicController.GetInstance().PlaySound(voiceOverClip, 1f);
}
dialog.Choose(chooseText, dialogOptions, timeoutDuration, delegate {
dialog.ShowDialog(false);
Continue();

6
Assets/Fungus/Dialog/Commands/Say.cs

@ -15,6 +15,7 @@ namespace Fungus.Script
public Character character;
public string storyText;
public AudioClip voiceOverClip;
public bool showOnce;
int executionCount;
@ -52,6 +53,11 @@ namespace Fungus.Script
dialog.SetCharacter(character);
if (voiceOverClip != null)
{
MusicController.GetInstance().PlaySound(voiceOverClip, 1f);
}
dialog.Say(storyText, delegate {
dialog.ShowDialog(false);
Continue();

6
Assets/Fungus/Dialog/Editor/ChooseEditor.cs

@ -30,6 +30,11 @@ namespace Fungus.Script
new GUIContent("<Default>"),
t.dialog);
AudioClip voiceOverClip = EditorGUILayout.ObjectField(new GUIContent("Voice Over Clip", "Voice over audio to play when the choose text is displayed"),
t.voiceOverClip,
typeof(AudioClip),
true) as AudioClip;
float timeoutDuration = EditorGUILayout.FloatField(new GUIContent("Timeout Duration", "Time limit for player to make a choice. Set to 0 for no limit."), t.timeoutDuration);
if (EditorGUI.EndChangeCheck())
@ -38,6 +43,7 @@ namespace Fungus.Script
t.chooseText = chooseText;
t.character = character;
t.dialog = dialog;
t.voiceOverClip = voiceOverClip;
t.timeoutDuration = timeoutDuration;
}
}

6
Assets/Fungus/Dialog/Editor/SayEditor.cs

@ -53,6 +53,11 @@ namespace Fungus.Script
new GUIContent("<Default>"),
t.dialog);
AudioClip voiceOverClip = EditorGUILayout.ObjectField(new GUIContent("Voice Over Clip", "Voice over audio to play when the say text is displayed"),
t.voiceOverClip,
typeof(AudioClip),
true) as AudioClip;
bool showOnce = EditorGUILayout.Toggle(new GUIContent("Show Once", "Show this text once and never show it again."), t.showOnce);
if (EditorGUI.EndChangeCheck())
@ -61,6 +66,7 @@ namespace Fungus.Script
t.storyText = text;
t.character = character;
t.dialog = dialog;
t.voiceOverClip = voiceOverClip;
t.showOnce = showOnce;
}
}

BIN
Assets/Shuttle/Destiny.mp3

Binary file not shown.

12
Assets/Shuttle/Destiny.mp3.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8433d11ae0a444319b220751cd17efec
AudioImporter:
serializedVersion: 4
format: 0
quality: .5
stream: 1
3D: 0
forceToMono: 0
useHardware: 0
loopable: 0
userData:

BIN
Assets/Shuttle/ShuttleGame.unity

Binary file not shown.

BIN
Assets/Shuttle/Welcome.mp3

Binary file not shown.

12
Assets/Shuttle/Welcome.mp3.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: aa3edbfe1ff8f43ef97d0f4b5ad341f0
AudioImporter:
serializedVersion: 4
format: 0
quality: .170000002
stream: 1
3D: 0
forceToMono: 0
useHardware: 0
loopable: 0
userData:
Loading…
Cancel
Save