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.

51 lines
865 B

using UnityEngine;
using System.Collections;
using Fungus;
public class SetVariableCommand : FungusCommand
{
public string variableKey;
public string stringValue;
public int integerValue;
public bool booleanValue;
public float floatValue;
public override void OnEnter()
{
if (variableKey.Length == 0)
{
Finish();
return;
}
Variable v = parentSequenceController.GetVariable(variableKey);
if (v == null)
{
Debug.LogError("Variable " + variableKey + " not defined.");
}
else
{
switch (v.type)
{
case VariableType.String:
v.stringValue = stringValue;
break;
case VariableType.Integer:
v.integerValue = integerValue;
break;
case VariableType.Float:
v.floatValue = floatValue;
break;
case VariableType.Boolean:
v.booleanValue = booleanValue;
break;
}
}
Finish();
}
}