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.
56 lines
942 B
56 lines
942 B
10 years ago
|
using UnityEngine;
|
||
10 years ago
|
using System.Collections;
|
||
|
|
||
10 years ago
|
namespace Fungus.Script
|
||
10 years ago
|
{
|
||
10 years ago
|
|
||
10 years ago
|
public class Set : FungusCommand
|
||
10 years ago
|
{
|
||
|
public string variableKey;
|
||
10 years ago
|
|
||
10 years ago
|
public BooleanData booleanData;
|
||
10 years ago
|
|
||
10 years ago
|
public IntegerData integerData;
|
||
10 years ago
|
|
||
10 years ago
|
public FloatData floatData;
|
||
10 years ago
|
|
||
10 years ago
|
public StringData stringData;
|
||
|
|
||
|
public override void OnEnter()
|
||
10 years ago
|
{
|
||
10 years ago
|
if (variableKey.Length == 0)
|
||
10 years ago
|
{
|
||
10 years ago
|
Continue();
|
||
|
return;
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
Variable v = parentFungusScript.GetVariable(variableKey);
|
||
|
if (v == null)
|
||
|
{
|
||
|
Debug.LogError("Variable " + variableKey + " not defined.");
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
switch (v.type)
|
||
|
{
|
||
|
case VariableType.Boolean:
|
||
|
v.booleanValue = booleanData.value;
|
||
|
break;
|
||
|
case VariableType.Integer:
|
||
|
v.integerValue = integerData.value;
|
||
|
break;
|
||
|
case VariableType.Float:
|
||
|
v.floatValue = floatData.value;
|
||
|
break;
|
||
|
case VariableType.String:
|
||
|
v.stringValue = stringData.value;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Continue();
|
||
|
}
|
||
10 years ago
|
}
|
||
10 years ago
|
|
||
10 years ago
|
}
|