An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
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.

40 lines
944 B

using UnityEngine;
using Fungus.Utils;
namespace Fungus
{
/// <summary>
/// Checks if Writer signals are being sent correctly.
/// </summary>
[AddComponentMenu("")]
public class WriterSignalsTester : MonoBehaviour
{
int step = 0;
void OnEnable()
{
WriterSignals.OnTextTagToken += OnTextTagToken;
}
void OnDisable()
{
WriterSignals.OnTextTagToken -= OnTextTagToken;
}
void OnTextTagToken(Writer writer, TextTagToken token)
{
if (step == 0 && token.type == TokenType.BoldStart)
{
step = 1;
}
else if (step == 1 && token.type == TokenType.Words)
{
step = 2;
}
else if (step == 2 && token.type == TokenType.BoldEnd)
{
IntegrationTest.Pass();
}
}
}
}