diff --git a/Assets/Fungus/Narrative/Editor/CharacterEditor.cs b/Assets/Fungus/Narrative/Editor/CharacterEditor.cs index cc2d662d..02433f14 100644 --- a/Assets/Fungus/Narrative/Editor/CharacterEditor.cs +++ b/Assets/Fungus/Narrative/Editor/CharacterEditor.cs @@ -16,6 +16,7 @@ namespace Fungus protected SerializedProperty portraitsProp; protected SerializedProperty portraitsFaceProp; protected SerializedProperty descriptionProp; + protected SerializedProperty setSayDialogProp; protected virtual void OnEnable() { @@ -25,6 +26,7 @@ namespace Fungus portraitsProp = serializedObject.FindProperty ("portraits"); portraitsFaceProp = serializedObject.FindProperty ("portraitsFace"); descriptionProp = serializedObject.FindProperty ("description"); + setSayDialogProp = serializedObject.FindProperty("setSayDialog"); } public override void OnInspectorGUI() @@ -36,9 +38,11 @@ namespace Fungus EditorGUILayout.PropertyField(nameTextProp, new GUIContent("Name Text", "Name of the character display in the dialog")); EditorGUILayout.PropertyField(nameColorProp, new GUIContent("Name Color", "Color of name text display in the dialog")); EditorGUILayout.PropertyField(soundEffectProp, new GUIContent("Sound Effect", "Sound to play when the character is talking. Overrides the setting in the Dialog.")); + EditorGUILayout.PropertyField(setSayDialogProp); EditorGUILayout.PropertyField(descriptionProp, new GUIContent("Description", "Notes about this story character (personality, attibutes, etc.)")); + if (t.portraits != null && - t.portraits.Count > 0) + t.portraits.Count > 0) { t.profileSprite = t.portraits[0]; } diff --git a/Assets/Fungus/Narrative/Scripts/Character.cs b/Assets/Fungus/Narrative/Scripts/Character.cs index 4d644f0e..cfea1ee7 100644 --- a/Assets/Fungus/Narrative/Scripts/Character.cs +++ b/Assets/Fungus/Narrative/Scripts/Character.cs @@ -15,8 +15,11 @@ namespace Fungus public AudioClip soundEffect; public Sprite profileSprite; public List portraits; - public FacingDirection portraitsFace; - public PortraitState state; + public FacingDirection portraitsFace; + public PortraitState state; + + [Tooltip("Sets the active Say dialog with a reference to a Say Dialog object in the scene. All story text will now display using this Say Dialog.")] + public SayDialog setSayDialog; [FormerlySerializedAs("notes")] [TextArea(5,10)] @@ -31,7 +34,7 @@ namespace Fungus activeCharacters.Add(this); } } - + protected virtual void OnDisable() { activeCharacters.Remove(this); @@ -40,7 +43,7 @@ namespace Fungus // // ILocalizable implementation // - + public virtual string GetStandardText() { return nameText; @@ -55,7 +58,7 @@ namespace Fungus { return description; } - + public virtual string GetStringId() { // String id for character names is CHARACTER. diff --git a/Assets/Fungus/Narrative/Scripts/Commands/Say.cs b/Assets/Fungus/Narrative/Scripts/Commands/Say.cs index 03536ab3..dbb6de44 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/Say.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/Say.cs @@ -58,6 +58,11 @@ namespace Fungus executionCount++; // Override the active say dialog if needed + if (character != null && character.setSayDialog != null) + { + SayDialog.activeSayDialog = character.setSayDialog; + } + if (setSayDialog != null) { SayDialog.activeSayDialog = setSayDialog;