Browse Source

Can click to complete text

master
chrisgregan 10 years ago
parent
commit
3a92be9734
  1. 24
      Assets/Fungus/Dialog/Scripts/Dialog.cs
  2. BIN
      Assets/Shuttle/ShuttleGame.unity

24
Assets/Fungus/Dialog/Scripts/Dialog.cs

@ -166,7 +166,14 @@ namespace Fungus.Script
{ {
timeAccumulator += Time.deltaTime; timeAccumulator += Time.deltaTime;
while (timeAccumulator > writeDelay) bool skipWriting = false;
if (Input.GetMouseButtonDown(0))
{
skipWriting = true;
}
while (skipWriting ||
timeAccumulator > writeDelay)
{ {
timeAccumulator -= writeDelay; timeAccumulator -= writeDelay;
@ -210,11 +217,12 @@ namespace Fungus.Script
IsPunctuation(glyph.param)) IsPunctuation(glyph.param))
{ {
// Ignore if next glyph is also punctuation, or if punctuation is the last character. // Ignore if next glyph is also punctuation, or if punctuation is the last character.
bool skip = (i < glyphs.Count - 1 && bool skipCharacter = (i < glyphs.Count - 1 &&
glyphs[i + 1].type == GlyphType.Character && glyphs[i + 1].type == GlyphType.Character &&
IsPunctuation(glyphs[i + 1].param)); IsPunctuation(glyphs[i + 1].param));
if (!skip) if (!skipCharacter &&
!skipWriting)
yield return new WaitForSeconds(currentPunctuationPause); yield return new WaitForSeconds(currentPunctuationPause);
} }
@ -251,8 +259,11 @@ namespace Fungus.Script
{ {
duration = 1f; duration = 1f;
} }
yield return new WaitForSeconds(duration); if (!skipWriting)
timeAccumulator = 0f; {
yield return new WaitForSeconds(duration);
timeAccumulator = 0f;
}
break; break;
case GlyphType.WaitForInputNoClear: case GlyphType.WaitForInputNoClear:
@ -345,8 +356,7 @@ namespace Fungus.Script
{ {
return character == "." || return character == "." ||
character == "?" || character == "?" ||
character == "!" || character == "!";
character == ",";
} }
List<Glyph> MakeGlyphList(string storyText) List<Glyph> MakeGlyphList(string storyText)

BIN
Assets/Shuttle/ShuttleGame.unity

Binary file not shown.
Loading…
Cancel
Save