From f79c04f8e02576a15d7bc4bcaebc62644373353f Mon Sep 17 00:00:00 2001 From: Christopher Date: Tue, 26 Jul 2016 15:49:38 +0100 Subject: [PATCH] Added Conversation command --- .../Scripts/Commands/Conversation.cs | 50 +++++++++++++++++++ .../Scripts/Commands/Conversation.cs.meta | 12 +++++ 2 files changed, 62 insertions(+) create mode 100644 Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs create mode 100644 Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs.meta diff --git a/Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs b/Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs new file mode 100644 index 00000000..48aaface --- /dev/null +++ b/Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs @@ -0,0 +1,50 @@ +/** + * This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus). + * It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) + */ + +using UnityEngine; +using UnityEngine.Serialization; +using System.Collections; + +namespace Fungus +{ + [CommandInfo("Narrative", + "Conversation", + "Do multiple say and portrait commands in a single block of text. Format is: [character] [portrait] [stage position] [: Story text]")] + [AddComponentMenu("")] + [ExecuteInEditMode] + public class Conversation : Command + { + public StringDataMulti conversationText; + + public ConversationManager conversationManager = new ConversationManager(); + + protected virtual void Start() + { + conversationManager.PopulateCharacterCache(); + } + + public override void OnEnter() + { + StartCoroutine(DoConversation()); + } + + protected virtual IEnumerator DoConversation() + { + yield return StartCoroutine(conversationManager.DoConversation(conversationText.Value)); + + Continue(); + } + + public override string GetSummary() + { + return conversationText.Value; + } + + public override Color GetButtonColor() + { + return new Color32(184, 210, 235, 255); + } + } +} \ No newline at end of file diff --git a/Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs.meta b/Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs.meta new file mode 100644 index 00000000..bd0a3940 --- /dev/null +++ b/Assets/Fungus/Narrative/Scripts/Commands/Conversation.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f608b8c9fb3044200aac956492d8d586 +timeCreated: 1469542178 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: