Hi,
DialogueManager.Pause pauses everything.
Instead, I recommend using a sequence for this. In general, the idea behind Lua (Script and Conditions fields) is to manage data such as variable values, and the idea behind sequences (Sequence field) is to control what the player sees and hears such as camera work and animation. The things that Lua and sequences do can overlap -- for example, you're free to do something visual in Lua, or set a variable in a sequencer command -- but this is the way I like to look at them.
Since this seems to be more of a user experience thing, here's how I would implement it:
1. Write a custom sequencer command called something like "ShowCustom":
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
namespace PixelCrushers.DialogueSystem.SequencerCommands
{
// Command: ShowCustom(action)
public class SequencerCommandShowCustom : SequencerCommand {
public IEnumerator Start() {
if (GetParameter(0) == "ShowMovingCircleImage")
{
float elapsedTime = 0;
while (elapsedTime < 5)
{
// Show your circle image, etc.
elapsedTime += Time.deltaTime;
yield return null;
}
}
Stop();
}
}
}
2. Use it in the dialogue entry node's
Sequence field:
- Sequence: ShowCustom(ShowMovingCircleImage)
A dialogue entry node waits until its sequence completes. If you pass this command "ShowMovingCircleImage", it does something for 5 seconds and then completes. This means the dialogue entry node will stay onscreen for 5 seconds. Note when you pass strings to sequencer commands, you don't wrap them in quotes. The syntax for sequencer commands was designed for non-technical authors, so it's ultra-simplified.
---
Alternate Method:
If you want to stick with Lua, here's an alternate method:
1. Use the "
@Message" syntax to set the dialogue entry node's
Sequence field to:
- Sequence: None()@Message(Done)
The None() sequencer command is a null command. However, because of the "@Message(Done)" at the end, it will wait until it receives a sequencer message "Done". This means the dialogue entry node will stay onscreen until it receives the "Done" message.
2. Set the
Script field to something like this:
- Script: CustomShowMethod("ShowMovingCircleImage")
3. Change your script to something like this:
Code: Select all
public class DialogueListener : MonoBehaviour
{
void OnEnable() {
Lua.RegisterFunction("CustomShowMethod", this, typeof(DialogueListener).GetMethod("CustomShowMethod"));
}
void OnDisable() {
Lua.UnregisterFunction("CustomShowMethod");
}
void CustomShowMethod(string action)
{
if (action == "ShowMovingCircleImage")
{
StartCoroutine(ShowMovingCircleImage());
}
}
IEnumerator ShowMovingCircleImage()
{
float elapsedTime = 0;
while (elapsedTime < 5)
{
elapsedTime += Time.deltaTime;
// Show your circle image, etc.
}
Sequencer.Message("Done");
}
}