Browse Source

Hold down shift while pressing key to advance instantly

Also added missing tooltips
master
chrisgregan 10 years ago
parent
commit
48947f6583
  1. 37
      Assets/Fungus/Narrative/Scripts/DialogInput.cs

37
Assets/Fungus/Narrative/Scripts/DialogInput.cs

@ -13,25 +13,31 @@ namespace Fungus
{ {
public enum ClickMode public enum ClickMode
{ {
Disabled, Disabled, // Clicking disabled
ClickAnywhere, ClickAnywhere, // Click anywhere on screen to advance
ClickOnDialog ClickOnDialog // Click anywhere on Say Dialog to advance
} }
public enum KeyPressMode public enum KeyPressMode
{ {
Disabled, Disabled, // Key pressing disabled
AnyKey, AnyKey, // Press any key to continue
KeyPressed KeyPressed // Press one of specified keys to advance
} }
[Tooltip("Click to advance story")]
public ClickMode clickMode; public ClickMode clickMode;
[Tooltip("Press a key to advance story")]
public KeyPressMode keyPressMode; public KeyPressMode keyPressMode;
public float nextClickDelay = 0.2f; [Tooltip("Hold down shift while pressing a key to advance though story instantly")]
public bool shiftKeyEnabled = true;
[Tooltip("Keycode of the key to activate on")] [Tooltip("Delay between consecutive clicks. Useful to prevent accidentally clicking through story.")]
public float nextClickDelay = 0f;
[Tooltip("Keycodes to check for key presses")]
public KeyCode[] keyList; public KeyCode[] keyList;
protected bool dialogClickedFlag; protected bool dialogClickedFlag;
@ -82,9 +88,20 @@ namespace Fungus
case KeyPressMode.KeyPressed: case KeyPressMode.KeyPressed:
foreach (KeyCode keyCode in keyList) foreach (KeyCode keyCode in keyList)
{ {
if (Input.GetKeyDown(keyCode)) if (shiftKeyEnabled &&
(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)))
{
if (Input.GetKey(keyCode))
{
SetNextLineFlag();
}
}
else
{ {
SetNextLineFlag(); if (Input.GetKeyDown(keyCode))
{
SetNextLineFlag();
}
} }
} }
break; break;

Loading…
Cancel
Save