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.

36 lines
614 B

using UnityEngine;
using System.Collections;
using Fungus;
public class SetVariableCommand : FungusCommand
{
public Variable variable;
public override void OnEnter()
{
if (variable.key.Length == 0)
{
Finish();
return;
}
Variable v = parentSequenceController.GetVariable(variable.key);
if (v == null)
{
Debug.LogError("Variable " + variable.key + " not defined.");
}
else
{
if (v.IsSameType(variable))
{
v.Assign(variable);
}
else
{
Debug.LogError("Variables " + variable.key + " and " + v.key + " are not of the same type.");
}
}
Finish();
}
}