You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.7 KiB
53 lines
1.7 KiB
8 years ago
|
// 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)
|
||
8 years ago
|
|
||
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
|
||
|
namespace Fungus
|
||
|
{
|
||
8 years ago
|
/// <summary>
|
||
|
/// Do multiple say and portrait commands in a single block of text. Format is: [character] [portrait] [stage position] [: Story text].
|
||
|
/// </summary>
|
||
8 years ago
|
[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
|
||
|
{
|
||
8 years ago
|
[SerializeField] protected StringDataMulti conversationText;
|
||
8 years ago
|
|
||
8 years ago
|
protected ConversationManager conversationManager = new ConversationManager();
|
||
8 years ago
|
|
||
|
protected virtual void Start()
|
||
|
{
|
||
|
conversationManager.PopulateCharacterCache();
|
||
|
}
|
||
|
|
||
8 years ago
|
public override void OnEnter()
|
||
|
{
|
||
8 years ago
|
StartCoroutine(DoConversation());
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
|
protected virtual IEnumerator DoConversation()
|
||
|
{
|
||
8 years ago
|
Flowchart flowchart = GetFlowchart();
|
||
|
string subbedText = flowchart.SubstituteVariables(conversationText.Value);
|
||
|
|
||
|
yield return StartCoroutine(conversationManager.DoConversation(subbedText));
|
||
8 years ago
|
|
||
|
Continue();
|
||
|
}
|
||
|
|
||
8 years ago
|
public override string GetSummary()
|
||
|
{
|
||
8 years ago
|
return conversationText.Value;
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
8 years ago
|
public override Color GetButtonColor()
|
||
|
{
|
||
|
return new Color32(184, 210, 235, 255);
|
||
|
}
|
||
|
}
|
||
8 years ago
|
}
|