Browse Source

Merge branch 'master' into stop-flowchart

master
chrisgregan 9 years ago
parent
commit
6051b2470e
  1. 28
      Assets/Fungus/CHANGELOG.txt
  2. 9
      Assets/Fungus/Flowchart/Editor/BlockEditor.cs
  3. 3
      Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs
  4. 8
      Assets/Fungus/Flowchart/Editor/FlowchartMenuItems.cs
  5. 57
      Assets/Fungus/Flowchart/Resources/Flowchart.prefab
  6. 19
      Assets/Fungus/Flowchart/Scripts/Flowchart.cs
  7. 0
      Assets/Fungus/LICENSE.txt
  8. 0
      Assets/Fungus/LICENSE.txt.meta
  9. 5
      Assets/Fungus/Narrative/Scripts/Commands/Menu.cs
  10. 2
      Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs
  11. 6
      Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs
  12. 2
      Assets/Fungus/Narrative/Scripts/DialogInput.cs
  13. 10
      Assets/Fungus/Narrative/Scripts/Localization.cs
  14. 23
      Assets/Fungus/Narrative/Scripts/SayDialog.cs
  15. 0
      Assets/Fungus/README.txt
  16. 0
      Assets/Fungus/README.txt.meta
  17. 44
      Assets/Fungus/UI/Scripts/WriterAudio.cs
  18. 0
      Assets/FungusExamples/EnterName.meta
  19. 484
      Assets/FungusExamples/EnterName/EnterName.unity
  20. 4
      Assets/FungusExamples/EnterName/EnterName.unity.meta
  21. 40
      Assets/FungusExamples/Sherlock/TheExperiment.unity
  22. 4947
      Assets/Tests/Narrative/NarrativeTests.unity
  23. 20
      Assets/Tests/Narrative/PortraitFlipTest.cs
  24. 12
      Assets/Tests/Narrative/PortraitFlipTest.cs.meta
  25. BIN
      Assets/Tests/TestAssets/Audio/VoiceOver.wav
  26. 22
      Assets/Tests/TestAssets/Audio/VoiceOver.wav.meta
  27. 26
      CONTRIBUTING.md
  28. 5
      README.md

28
Assets/Fungus/CHANGELOG.txt

@ -1,3 +1,31 @@
Fungus v2.2.1
=============
# Added
- Set Interactable command to control UI button, input field, etc. interactivity #178
- Button Clicked event handler to execute a block when a UI button is clicked
- End Edit event handler to execute a block when user presses enter in an input field
- Hide specific commands & categories in the Add Command menu by setting the Hide Commands property on Flowchart
# Changed
- Improved Enter Name example to demonstrate the new Write, Get Text, Set Text, Set Interactable, etc. commands.
- Removed punctuation pause for last character in a sentence #168
- Removed unsupported 'shiver' item from tag help description in Say and Write commands
- Moved LICENSE and README inside the Fungus folder #185
# Fixed
- Concurrent Say calls cause Say Dialog to freeze up #156
- Null reference error after editing Flowchart code #181
- Markup text visible if rich text not enabled when using Write command #176
- ControlAudio waitUntilFinished property doesn't wait for correct time #174
- Removed legacy hidden objects in example scenes #159
- Undo for delete command doesn't work #161
- Flowchart in The Hunter example has Hide Components set to false #150
Fungus v2.2.0 Fungus v2.2.0
============= =============

9
Assets/Fungus/Flowchart/Editor/BlockEditor.cs

@ -399,6 +399,9 @@ namespace Fungus
newHandler.parentBlock = block; newHandler.parentBlock = block;
block.eventHandler = newHandler; block.eventHandler = newHandler;
} }
// Because this is an async call, we need to force prefab instances to record changes
PrefabUtility.RecordPrefabInstancePropertyModifications(block);
} }
protected virtual void UpdateIndentLevels(Block block) protected virtual void UpdateIndentLevels(Block block)
@ -764,6 +767,9 @@ namespace Fungus
{ {
block.commandList.Add(newCommand); block.commandList.Add(newCommand);
} }
// Because this is an async call, we need to force prefab instances to record changes
PrefabUtility.RecordPrefabInstancePropertyModifications(block);
} }
public virtual void ShowContextMenu() public virtual void ShowContextMenu()
@ -968,6 +974,9 @@ namespace Fungus
} }
} }
// Because this is an async call, we need to force prefab instances to record changes
PrefabUtility.RecordPrefabInstancePropertyModifications(block);
Repaint(); Repaint();
} }

3
Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs

@ -229,6 +229,9 @@ namespace Fungus
Variable newVariable = flowchart.gameObject.AddComponent(variableType) as Variable; Variable newVariable = flowchart.gameObject.AddComponent(variableType) as Variable;
newVariable.key = flowchart.GetUniqueVariableKey(""); newVariable.key = flowchart.GetUniqueVariableKey("");
flowchart.variables.Add(newVariable); flowchart.variables.Add(newVariable);
// Because this is an async call, we need to force prefab instances to record changes
PrefabUtility.RecordPrefabInstancePropertyModifications(flowchart);
} }
public static List<System.Type> FindAllDerivedTypes<T>() public static List<System.Type> FindAllDerivedTypes<T>()

8
Assets/Fungus/Flowchart/Editor/FlowchartMenuItems.cs

@ -13,6 +13,14 @@ namespace Fungus
{ {
GameObject go = SpawnPrefab("Flowchart"); GameObject go = SpawnPrefab("Flowchart");
go.transform.position = Vector3.zero; go.transform.position = Vector3.zero;
// Only the first created Flowchart in the scene should have a default GameStarted block
if (GameObject.FindObjectsOfType<Flowchart>().Length > 1)
{
Block block = go.GetComponent<Block>();
block.eventHandler = null;
GameObject.DestroyImmediate(block.eventHandler);
}
} }
[MenuItem("Tools/Fungus/Create/Fungus Logo", false, 1000)] [MenuItem("Tools/Fungus/Create/Fungus Logo", false, 1000)]

57
Assets/Fungus/Flowchart/Resources/Flowchart.prefab

@ -9,9 +9,9 @@ GameObject:
m_Component: m_Component:
- 4: {fileID: 467082} - 4: {fileID: 467082}
- 114: {fileID: 11430050} - 114: {fileID: 11430050}
- 114: {fileID: 11417010}
- 114: {fileID: 11433304} - 114: {fileID: 11433304}
- 114: {fileID: 11462346} - 114: {fileID: 11462346}
- 114: {fileID: 11456218}
m_Layer: 0 m_Layer: 0
m_Name: Flowchart m_Name: Flowchart
m_TagString: Untagged m_TagString: Untagged
@ -31,18 +31,6 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
--- !u!114 &11417010
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 142980}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d2f6487d21a03404cb21b245f0242e79, type: 3}
m_Name:
m_EditorClassIdentifier:
parentBlock: {fileID: 0}
--- !u!114 &11430050 --- !u!114 &11430050
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -54,6 +42,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
version: 1.0
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
variablesScrollPos: {x: 0, y: 0} variablesScrollPos: {x: 0, y: 0}
variablesExpanded: 1 variablesExpanded: 1
@ -69,11 +58,12 @@ MonoBehaviour:
selectedCommands: [] selectedCommands: []
variables: [] variables: []
description: description:
runSlowDuration: .25 stepPause: 0
colorCommands: 1 colorCommands: 1
hideComponents: 1 hideComponents: 1
saveSelection: 1 saveSelection: 1
nextItemId: 1 localizationId:
hideCommands: []
--- !u!114 &11433304 --- !u!114 &11433304
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -88,15 +78,40 @@ MonoBehaviour:
nodeRect: nodeRect:
serializedVersion: 2 serializedVersion: 2
x: 67 x: 67
y: 69 y: 70
width: 120 width: 120
height: 40 height: 40
itemId: 0 itemId: 0
blockName: New Block blockName: New Block
description: description:
runSlowInEditor: 1
eventHandler: {fileID: 11462346} eventHandler: {fileID: 11462346}
commandList: [] commandList:
- {fileID: 11456218}
--- !u!114 &11456218
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 142980}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ec422cd568a9c4a31ad7c36d0572b9da, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 1
errorMessage:
indentLevel: 0
storyText: Hi
description:
character: {fileID: 0}
portrait: {fileID: 0}
voiceOverClip: {fileID: 0}
showAlways: 1
showCount: 1
extendPrevious: 0
fadeWhenDone: 1
waitForClick: 1
setSayDialog: {fileID: 0}
--- !u!114 &11462346 --- !u!114 &11462346
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -115,7 +130,11 @@ Prefab:
serializedVersion: 2 serializedVersion: 2
m_Modification: m_Modification:
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: [] m_Modifications:
- target: {fileID: 0}
propertyPath: hideComponents
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 0} m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 142980} m_RootGameObject: {fileID: 142980}

19
Assets/Fungus/Flowchart/Scripts/Flowchart.cs

@ -247,6 +247,10 @@ namespace Fungus
Block[] blocks = GetComponentsInChildren<Block>(); Block[] blocks = GetComponentsInChildren<Block>();
// Remove any null entries in the variables list
// It shouldn't happen but it seemed to occur for a user on the forum
variables.RemoveAll(item => item == null);
foreach (Variable variable in GetComponents<Variable>()) foreach (Variable variable in GetComponents<Variable>())
{ {
if (!variables.Contains(variable)) if (!variables.Contains(variable))
@ -310,14 +314,7 @@ namespace Fungus
} }
protected virtual void Initialize() protected virtual void Initialize()
{ {}
// If there are other flowcharts in the scene and the selected block has the default name, then this is probably a new block.
// Reset the event handler of the new flowchart's default block to avoid crashes.
if (selectedBlock && cachedFlowcharts.Count > 1 && selectedBlock.blockName == DEFAULT_BLOCK_NAME)
{
selectedBlock.eventHandler = null;
}
}
protected virtual Block CreateBlockComponent(GameObject parent) protected virtual Block CreateBlockComponent(GameObject parent)
{ {
@ -893,6 +890,9 @@ namespace Fungus
// Look for any matching variables in this Flowchart first (public or private) // Look for any matching variables in this Flowchart first (public or private)
foreach (Variable variable in variables) foreach (Variable variable in variables)
{ {
if (variable == null)
continue;
if (variable.key == key) if (variable.key == key)
{ {
string value = variable.ToString(); string value = variable.ToString();
@ -911,6 +911,9 @@ namespace Fungus
foreach (Variable variable in flowchart.variables) foreach (Variable variable in flowchart.variables)
{ {
if (variable == null)
continue;
if (variable.scope == VariableScope.Public && if (variable.scope == VariableScope.Public &&
variable.key == key) variable.key == key)
{ {

0
Assets/LICENSE.txt → Assets/Fungus/LICENSE.txt

0
Assets/LICENSE.txt.meta → Assets/Fungus/LICENSE.txt.meta

5
Assets/Fungus/Narrative/Scripts/Commands/Menu.cs

@ -47,7 +47,10 @@ namespace Fungus
if (menuDialog != null) if (menuDialog != null)
{ {
menuDialog.gameObject.SetActive(true); menuDialog.gameObject.SetActive(true);
string displayText = text;
Flowchart flowchart = GetFlowchart();
string displayText = flowchart.SubstituteVariables(text);
menuDialog.AddOption(displayText, interactable, targetBlock); menuDialog.AddOption(displayText, interactable, targetBlock);
} }
} }

2
Assets/Fungus/Narrative/Scripts/Commands/Portrait.cs

@ -381,6 +381,8 @@ namespace Fungus
GameObject tempGO = GameObject.Instantiate(character.state.portraitImage.gameObject); GameObject tempGO = GameObject.Instantiate(character.state.portraitImage.gameObject);
tempGO.transform.SetParent(character.state.portraitImage.transform, false); tempGO.transform.SetParent(character.state.portraitImage.transform, false);
tempGO.transform.localPosition = Vector3.zero; tempGO.transform.localPosition = Vector3.zero;
tempGO.transform.localScale = character.state.position.localScale;
Image tempImage = tempGO.GetComponent<Image>(); Image tempImage = tempGO.GetComponent<Image>();
tempImage.sprite = character.state.portraitImage.sprite; tempImage.sprite = character.state.portraitImage.sprite;
tempImage.preserveAspect = true; tempImage.preserveAspect = true;

6
Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs

@ -12,12 +12,18 @@ namespace Fungus
[Tooltip("Code of the language to set. e.g. ES, DE, JA")] [Tooltip("Code of the language to set. e.g. ES, DE, JA")]
public string languageCode; public string languageCode;
public static string mostRecentLanguage = "";
public override void OnEnter() public override void OnEnter()
{ {
Localization localization = GameObject.FindObjectOfType<Localization>(); Localization localization = GameObject.FindObjectOfType<Localization>();
if (localization != null) if (localization != null)
{ {
localization.SetActiveLanguage(languageCode, true); localization.SetActiveLanguage(languageCode, true);
// Cache the most recently set language code so we can continue to
// use the same language in subsequent scenes.
mostRecentLanguage = languageCode;
} }
Continue(); Continue();

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

@ -144,7 +144,7 @@ namespace Fungus
// Ignore input events if a Menu is being displayed // Ignore input events if a Menu is being displayed
if (MenuDialog.activeMenuDialog != null) if (MenuDialog.activeMenuDialog != null)
{ {
if (MenuDialog.activeMenuDialog.gameObject.activeSelf) if (MenuDialog.activeMenuDialog.gameObject.activeInHierarchy)
{ {
dialogClickedFlag = false; dialogClickedFlag = false;
nextLineInputFlag = false; nextLineInputFlag = false;

10
Assets/Fungus/Narrative/Scripts/Localization.cs

@ -56,6 +56,16 @@ namespace Fungus
[NonSerialized] [NonSerialized]
public string notificationText = ""; public string notificationText = "";
public virtual void OnLevelWasLoaded(int level)
{
// Check if a language has been selected using the Set Language command in a previous scene.
if (SetLanguage.mostRecentLanguage != "")
{
// This language will be used when Start() is called
activeLanguage = SetLanguage.mostRecentLanguage;
}
}
public virtual void Start() public virtual void Start()
{ {
CacheLocalizeableObjects(); CacheLocalizeableObjects();

23
Assets/Fungus/Narrative/Scripts/SayDialog.cs

@ -129,12 +129,12 @@ namespace Fungus
} }
} }
public virtual void Say(string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, AudioClip audioClip, Action onComplete) public virtual void Say(string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, AudioClip voiceOverClip, Action onComplete)
{ {
StartCoroutine(SayInternal(text, clearPrevious, waitForInput, fadeWhenDone, audioClip, onComplete)); StartCoroutine(SayInternal(text, clearPrevious, waitForInput, fadeWhenDone, voiceOverClip, onComplete));
} }
protected virtual IEnumerator SayInternal(string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, AudioClip audioClip, Action onComplete) protected virtual IEnumerator SayInternal(string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, AudioClip voiceOverClip, Action onComplete)
{ {
Writer writer = GetWriter(); Writer writer = GetWriter();
@ -148,15 +148,20 @@ namespace Fungus
this.fadeWhenDone = fadeWhenDone; this.fadeWhenDone = fadeWhenDone;
// Look for a character sound effect if no voice over clip is specified // Voice over clip takes precedence over a character sound effect if provided
AudioClip clip = audioClip;
if (speakingCharacter != null && AudioClip soundEffectClip = null;
clip == null) if (voiceOverClip != null)
{
WriterAudio writerAudio = GetWriterAudio();
writerAudio.PlayVoiceover(voiceOverClip);
}
else if (speakingCharacter != null)
{ {
clip = speakingCharacter.soundEffect; soundEffectClip = speakingCharacter.soundEffect;
} }
writer.Write(text, clearPrevious, waitForInput, soundEffectClip, onComplete);
writer.Write(text, clearPrevious, waitForInput, clip, onComplete);
} }
protected virtual void LateUpdate() protected virtual void LateUpdate()

0
Assets/README.txt → Assets/Fungus/README.txt

0
Assets/README.txt.meta → Assets/Fungus/README.txt.meta

44
Assets/Fungus/UI/Scripts/WriterAudio.cs

@ -43,6 +43,9 @@ namespace Fungus
// When true, a beep will be played on every written character glyph // When true, a beep will be played on every written character glyph
protected bool playBeeps; protected bool playBeeps;
// True when a voiceover clip is playing
protected bool playingVoiceover = false;
public virtual void SetAudioMode(AudioMode mode) public virtual void SetAudioMode(AudioMode mode)
{ {
audioMode = mode; audioMode = mode;
@ -63,6 +66,28 @@ namespace Fungus
targetAudioSource.volume = 0f; targetAudioSource.volume = 0f;
} }
/**
* Plays a voiceover audio clip.
* Voiceover behaves differently than speaking sound effects because it
* should keep on playing after the text has finished writing. It also
* does not pause for wait tags, punctuation, etc.
*/
public virtual void PlayVoiceover(AudioClip voiceOverClip)
{
if (targetAudioSource == null)
{
return;
}
playingVoiceover = true;
targetAudioSource.volume = 1f;
targetVolume = 1f;
targetAudioSource.loop = false;
targetAudioSource.clip = voiceOverClip;
targetAudioSource.Play();
}
public virtual void Play(AudioClip audioClip) public virtual void Play(AudioClip audioClip)
{ {
if (targetAudioSource == null || if (targetAudioSource == null ||
@ -72,6 +97,7 @@ namespace Fungus
return; return;
} }
playingVoiceover = false;
targetAudioSource.volume = 0f; targetAudioSource.volume = 0f;
targetVolume = 1f; targetVolume = 1f;
@ -122,6 +148,7 @@ namespace Fungus
targetVolume = 0f; targetVolume = 0f;
targetAudioSource.loop = false; targetAudioSource.loop = false;
playBeeps = false; playBeeps = false;
playingVoiceover = false;
} }
public virtual void Resume() public virtual void Resume()
@ -154,16 +181,28 @@ namespace Fungus
public virtual void OnStart(AudioClip audioClip) public virtual void OnStart(AudioClip audioClip)
{ {
if (playingVoiceover)
{
return;
}
Play(audioClip); Play(audioClip);
} }
public virtual void OnPause() public virtual void OnPause()
{ {
if (playingVoiceover)
{
return;
}
Pause(); Pause();
} }
public virtual void OnResume() public virtual void OnResume()
{ {
if (playingVoiceover)
{
return;
}
Resume(); Resume();
} }
@ -174,6 +213,11 @@ namespace Fungus
public virtual void OnGlyph() public virtual void OnGlyph()
{ {
if (playingVoiceover)
{
return;
}
if (playBeeps && beepSounds.Count > 0) if (playBeeps && beepSounds.Count > 0)
{ {
if (!targetAudioSource.isPlaying) if (!targetAudioSource.isPlaying)

0
Assets/FungusExamples/InputText.meta → Assets/FungusExamples/EnterName.meta

484
Assets/FungusExamples/InputText/InputText.unity → Assets/FungusExamples/EnterName/EnterName.unity

@ -172,6 +172,19 @@ GameObject:
- 114: {fileID: 163283986} - 114: {fileID: 163283986}
- 114: {fileID: 163283989} - 114: {fileID: 163283989}
- 114: {fileID: 163283990} - 114: {fileID: 163283990}
- 114: {fileID: 163283992}
- 114: {fileID: 163283993}
- 114: {fileID: 163283991}
- 114: {fileID: 163283994}
- 114: {fileID: 163283996}
- 114: {fileID: 163283995}
- 114: {fileID: 163283999}
- 114: {fileID: 163283998}
- 114: {fileID: 163283997}
- 114: {fileID: 163284002}
- 114: {fileID: 163284001}
- 114: {fileID: 163284000}
- 114: {fileID: 163284003}
m_Layer: 0 m_Layer: 0
m_Name: Flowchart m_Name: Flowchart
m_TagString: Untagged m_TagString: Untagged
@ -199,24 +212,36 @@ MonoBehaviour:
zoom: 1 zoom: 1
scrollViewRect: scrollViewRect:
serializedVersion: 2 serializedVersion: 2
x: -343 x: -378
y: -340 y: -354
width: 1114 width: 1243
height: 859 height: 1069
selectedBlock: {fileID: 163283984} selectedBlock: {fileID: 163283984}
selectedCommands: [] selectedCommands:
- {fileID: 163284003}
variables: variables:
- {fileID: 163283985} - {fileID: 163283985}
description: 'Shows how to read text from a UI input field, description: 'This example shows how to write to a 3D Text Mesh using
store the value in a string variable, and then use the the Writer component and a Write command.
string variable in a Say command.'
It also shows how to read text from a UI input field,
store the entered value in a string variable, and then use the
string variable in Write and Say commands.
The input field is set to be non interactable once the player
has entered their name using the Set Interactable command.'
stepPause: 0 stepPause: 0
colorCommands: 1 colorCommands: 1
hideComponents: 1 hideComponents: 1
saveSelection: 1 saveSelection: 1
localizationId: localizationId:
hideCommands: []
--- !u!114 &163283984 --- !u!114 &163283984
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 2 m_ObjectHideFlags: 2
@ -231,16 +256,21 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
nodeRect: nodeRect:
serializedVersion: 2 serializedVersion: 2
x: 67 x: 212
y: 70 y: 180
width: 120 width: 120
height: 40 height: 40
itemId: 0 itemId: 0
blockName: ReadText blockName: ReadText
description: description: Handles user clicking the ok button
eventHandler: {fileID: 163283990} eventHandler: {fileID: 163283990}
commandList: commandList:
- {fileID: 163283988} - {fileID: 163283988}
- {fileID: 163284003}
- {fileID: 163283994}
- {fileID: 163283999}
- {fileID: 163283998}
- {fileID: 163283997}
- {fileID: 163283986} - {fileID: 163283986}
- {fileID: 163283989} - {fileID: 163283989}
--- !u!114 &163283985 --- !u!114 &163283985
@ -255,7 +285,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
scope: 0 scope: 0
key: EnteredText key: PlayerName
value: value:
--- !u!114 &163283986 --- !u!114 &163283986
MonoBehaviour: MonoBehaviour:
@ -271,7 +301,7 @@ MonoBehaviour:
itemId: 2 itemId: 2
errorMessage: errorMessage:
indentLevel: 0 indentLevel: 0
storyText: 'You entered: {$EnteredText}' storyText: Hi {$PlayerName}, how are you today?
description: description:
character: {fileID: 0} character: {fileID: 0}
portrait: {fileID: 0} portrait: {fileID: 0}
@ -331,7 +361,7 @@ MonoBehaviour:
booleanVal: 0 booleanVal: 0
--- !u!114 &163283990 --- !u!114 &163283990
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 163283982} m_GameObject: {fileID: 163283982}
@ -342,6 +372,263 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
parentBlock: {fileID: 163283984} parentBlock: {fileID: 163283984}
targetButton: {fileID: 373310154} targetButton: {fileID: 373310154}
--- !u!114 &163283991
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 163283982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ad2261dbe44de43a980e6f7c77c88f7f, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 6
errorMessage:
indentLevel: 0
textObject: {fileID: 717539585}
text:
stringRef: {fileID: 0}
stringVal: Hello! Please enter your name
description:
clearText: 1
waitUntilFinished: 1
textColor: 0
setAlpha:
floatRef: {fileID: 0}
floatVal: 1
setColor:
colorRef: {fileID: 0}
colorVal: {r: 1, g: 1, b: 1, a: 1}
--- !u!114 &163283992
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 163283982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3}
m_Name:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 60
y: 60
width: 120
height: 40
itemId: 5
blockName: Start
description:
eventHandler: {fileID: 163283993}
commandList:
- {fileID: 163283996}
- {fileID: 163283991}
- {fileID: 163283995}
--- !u!114 &163283993
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 163283982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d2f6487d21a03404cb21b245f0242e79, type: 3}
m_Name:
m_EditorClassIdentifier:
parentBlock: {fileID: 163283992}
--- !u!114 &163283994
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 163283982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ad2261dbe44de43a980e6f7c77c88f7f, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 7
errorMessage:
indentLevel: 0
textObject: {fileID: 717539585}
text:
stringRef: {fileID: 0}
stringVal: Nice to meet you {$PlayerName}
description:
clearText: 1
waitUntilFinished: 1
textColor: 0
setAlpha:
floatRef: {fileID: 0}
floatVal: 1
setColor:
colorRef: {fileID: 0}
colorVal: {r: 1, g: 1, b: 1, a: 1}
--- !u!114 &163283995
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 163283982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dbd8c931f22994b9d90e2037fffaa770, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 9
errorMessage:
indentLevel: 0
targetGameObject: {fileID: 1538358643}
activeState:
booleanRef: {fileID: 0}
booleanVal: 1
--- !u!114 &163283996
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 163283982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dbd8c931f22994b9d90e2037fffaa770, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 8
errorMessage:
indentLevel: 0
targetGameObject: {fileID: 1538358643}
activeState:
booleanRef: {fileID: 0}
booleanVal: 0
--- !u!114 &163283997
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 163283982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dbd8c931f22994b9d90e2037fffaa770, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 12
errorMessage:
indentLevel: 0
targetGameObject: {fileID: 1538358643}
activeState:
booleanRef: {fileID: 0}
booleanVal: 0
--- !u!114 &163283998
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 163283982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3315ad2ebb85443909a1203d56d9344e, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 11
errorMessage:
indentLevel: 0
duration: 2
--- !u!114 &163283999
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 163283982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ab0d0ed4a2ca94c81a230a0ecce6e6e4, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 10
errorMessage:
indentLevel: 0
targetObjects:
- {fileID: 1229749171}
- {fileID: 373310152}
interactableState:
booleanRef: {fileID: 0}
booleanVal: 0
--- !u!114 &163284000
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 163283982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 050fb9e6e72f442b3b883da8a965bdeb, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 14
errorMessage:
indentLevel: 0
targetFlowchart: {fileID: 0}
targetBlock: {fileID: 163283984}
callMode: 0
--- !u!114 &163284001
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 163283982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5942d3ed820e745b2beca47228bac126, type: 3}
m_Name:
m_EditorClassIdentifier:
parentBlock: {fileID: 163284002}
targetInputField: {fileID: 1229749173}
--- !u!114 &163284002
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 163283982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3}
m_Name:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 42
y: 179
width: 120
height: 40
itemId: 13
blockName: End Edit
description: 'Handles user pressing
enter after typing in name'
eventHandler: {fileID: 163284001}
commandList:
- {fileID: 163284000}
--- !u!114 &163284003
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 163283982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 78c0367bf08d147bd80b5454de50e9d4, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 15
errorMessage:
indentLevel: 0
targetTextObject: {fileID: 749435734}
text:
stringRef: {fileID: 0}
stringVal: 'Player Name: {$PlayerName}'
description:
_textObjectObsolete: {fileID: 0}
--- !u!1 &373310152 --- !u!1 &373310152
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -598,6 +885,98 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 3
--- !u!1 &717539585
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 717539588}
- 23: {fileID: 717539587}
- 102: {fileID: 717539586}
- 114: {fileID: 717539589}
m_Layer: 0
m_Name: TextMesh
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!102 &717539586
TextMesh:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 717539585}
m_Text: Hello World
m_OffsetZ: 0
m_CharacterSize: 1
m_LineSpacing: 1
m_Anchor: 0
m_Alignment: 0
m_TabSize: 4
m_FontSize: 30
m_FontStyle: 0
m_RichText: 1
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_Color:
serializedVersion: 2
rgba: 4294967295
--- !u!23 &717539587
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 717539585}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_Materials:
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 1
m_ReflectionProbeUsage: 1
m_ProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_ImportantGI: 0
m_AutoUVMaxDistance: .5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!4 &717539588
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 717539585}
m_LocalRotation: {x: -.141357124, y: -.359562516, z: -.00671201246, w: .922327459}
m_LocalPosition: {x: -5.17288876, y: 2.77179241, z: -1.99707866}
m_LocalScale: {x: .35265398, y: .35265395, z: 1.76326978}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
--- !u!114 &717539589
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 717539585}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a676940fce6344af1a70043b089a6c14, type: 3}
m_Name:
m_EditorClassIdentifier:
targetTextObject: {fileID: 0}
writingSpeed: 60
punctuationPause: .25
hiddenTextColor: {r: 0, g: .433113754, b: .860294104, a: 1}
writeWholeWords: 0
forceRichText: 1
--- !u!1 &723295648 --- !u!1 &723295648
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -657,7 +1036,7 @@ Camera:
near clip plane: .300000012 near clip plane: .300000012
far clip plane: 1000 far clip plane: 1000
field of view: 60 field of view: 60
orthographic: 1 orthographic: 0
orthographic size: 5 orthographic size: 5
m_Depth: -1 m_Depth: -1
m_CullingMask: m_CullingMask:
@ -753,6 +1132,80 @@ CanvasRenderer:
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 747531185} m_GameObject: {fileID: 747531185}
--- !u!1 &749435734
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 749435735}
- 222: {fileID: 749435737}
- 114: {fileID: 749435736}
m_Layer: 5
m_Name: PlayerNameText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &749435735
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 749435734}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1538358644}
m_RootOrder: 1
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 193, y: -46}
m_SizeDelta: {x: 349, y: 59}
m_Pivot: {x: .5, y: .5}
--- !u!114 &749435736
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 749435734}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .903448224, g: 1, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 'Player Name: None
'
--- !u!222 &749435737
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 749435734}
--- !u!1 &974633902 --- !u!1 &974633902
GameObject: GameObject:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -1023,6 +1476,7 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0}
m_Children: m_Children:
- {fileID: 747531186} - {fileID: 747531186}
- {fileID: 749435735}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 2 m_RootOrder: 2
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}

4
Assets/FungusExamples/InputText/InputText.unity.meta → Assets/FungusExamples/EnterName/EnterName.unity.meta

@ -1,6 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 5e4fd7512414a443da20c316b2e0c6db guid: 1007fbdf3eb3244088015ada3e0bfaa4
timeCreated: 1440775895 timeCreated: 1442413549
licenseType: Free licenseType: Free
DefaultImporter: DefaultImporter:
userData: userData:

40
Assets/FungusExamples/Sherlock/TheExperiment.unity

@ -3356,6 +3356,7 @@ MonoBehaviour:
hideComponents: 1 hideComponents: 1
saveSelection: 1 saveSelection: 1
localizationId: localizationId:
hideCommands: []
--- !u!4 &1390555296 --- !u!4 &1390555296
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -6334,45 +6335,6 @@ Transform:
- {fileID: 2016355052} - {fileID: 2016355052}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 5 m_RootOrder: 5
--- !u!1 &1783296562
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1783296564}
- 114: {fileID: 1783296563}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1783296563
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1783296562}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8dfdac2fb606245c8a8cc28aace87e8b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1783296564
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1783296562}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: .164999962, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
--- !u!1 &1789234733 --- !u!1 &1789234733
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

4947
Assets/Tests/Narrative/NarrativeTests.unity

File diff suppressed because it is too large Load Diff

20
Assets/Tests/Narrative/PortraitFlipTest.cs

@ -0,0 +1,20 @@
using UnityEngine;
using System.Collections;
public class PortraitFlipTest : MonoBehaviour {
void Update ()
{
Transform t = gameObject.transform.FindChild("Canvas/JohnCharacter");
if (t == null)
{
return;
}
if (t.transform.localScale.x != -1f)
{
IntegrationTest.Fail("Character object not flipped horizontally");
}
}
}

12
Assets/Tests/Narrative/PortraitFlipTest.cs.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: cd9f5c93d50b44e9ba1b822ff6993500
timeCreated: 1444231183
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Tests/TestAssets/Audio/VoiceOver.wav

Binary file not shown.

22
Assets/Tests/TestAssets/Audio/VoiceOver.wav.meta

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 9301ee931368e4d8997d0c272b06fe91
timeCreated: 1444296783
licenseType: Free
AudioImporter:
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

26
CONTRIBUTING.md

@ -0,0 +1,26 @@
# Contributing
We welcome pull requests from everyone. By contributing to this project, you agree to abide by the Fungus [code of conduct]. You also agree that by submitting a pull request for this project, **[your contribution will be licensed under the MIT license for this project][fungus license]**.
Fork and clone the Fungus repo (see [fork a repo] )
Make sure the tests pass locally (more information on how to do this coming soon).
Make your change. Add tests for your change. Make the tests pass locally.
Push to your fork and [submit a pull request][pr].
[pr]: https://github.com/fungusgames/Fungus/compare/
We will try to give initial feedback to pull requests within 3 days or sooner. However, this may not always be possible. Please be patient, we will look at every pull request as soon as we can.
Your pull request will have a better chance of being accepted if you do the following:
* Write tests (more information on how to do this coming soon).
* Follow our coding style (details coming soon !)
* Write a [good commit message][commit].
[code of conduct]: https://fungusgames.com/code-of-conduct
[commit]: http://chris.beams.io/posts/git-commit/
[fork a repo]: https://help.github.com/articles/fork-a-repo/
[fungus license]: https://github.com/FungusGames/Fungus/blob/master/LICENSE

5
README.md

@ -24,7 +24,10 @@ http://fungusgames.com/forum
Contributing Contributing
============ ============
To contribute code to Fungus, please see [CONTRIBUTING][contributing]. If you are interested in contributing in some other way (art, audio, documentation, pizza) just email me at chris at fungusgames.com.
[contributing]: https://github.com/FungusGames/Fungus/blob/master/CONTRIBUTING.md
Many thanks to everyone who has contributed code to the project. Many thanks to everyone who has contributed code to the project.
https://github.com/fungusgames/fungus/graphs/contributors https://github.com/fungusgames/fungus/graphs/contributors
If you would like to contribute a bug fix or new feature, please submit a pull request on github. If you are interested in contributing in some other way (art, audio, documentation, pizza) just email me at chris at snozbot.com.

Loading…
Cancel
Save