using UnityEngine;
using ORKFramework;
using System.Collections;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Ork Framework")]
[Tooltip("Set or create an ork variable. Leave unused values empty!")]
public class SetOrkVariable : FsmStateAction
{
public enum VarType
{
String,
Bool,
Float,
Vector3
}
[RequiredField]
[Tooltip("The type of the ork variable.")]
public VarType orkVariableType;
[RequiredField]
[Tooltip("The name of the variable you wish to use.")]
public FsmString orkVariableName;
[ActionSection("Set Value")]
[Tooltip("The string value of the variable.")]
public FsmString orkVariableString;
[Tooltip("The bool value of the variable.")]
public FsmBool orkVariableBool;
[Tooltip("The float value of the variable.")]
public FsmFloat orkVariableFloat;
[Tooltip("The vector3 value of the variable.")]
public FsmVector3 orkVariableVector3;
public override void Reset()
{
orkVariableType = 0;
orkVariableName = "";
orkVariableString = "";
orkVariableBool = null;
orkVariableFloat = null;
orkVariableVector3 = null;
}
public override void OnUpdate()
{
switch (orkVariableType)
{
case VarType.String:
ORK.Game.Variables.Set(orkVariableName.Value,orkVariableString.Value);
break;
case VarType.Bool:
ORK.Game.Variables.Set(orkVariableName.Value,orkVariableBool.Value);
break;
case VarType.Float:
ORK.Game.Variables.Set(orkVariableName.Value,orkVariableFloat.Value);
break;
case VarType.Vector3:
ORK.Game.Variables.Set(orkVariableName.Value,orkVariableVector3.Value);
break;
}
Finish();
}
}
}
It looks like you're new here. If you want to get involved, click one of these buttons!