public static void AddVarToFsm(BTFsm owner, BTVariable variable) { if (BTEditorWindow.HasPrefab(owner)) { if (owner.template == null) { AddTemplateToFsm(owner); owner.template.startEvent = owner.startEvent; owner.template.totalEvent = owner.totalEvent; } if (owner.template.totalVariable == null) { owner.template.totalVariable = new List <BTVariable>(); } owner.template.totalVariable.Add(variable); BTEditorWindow.AddObjectToAsset(variable, owner.template); EditorUtility.SetDirty(owner); } else { if (owner.template != null) { owner.template.totalVariable.Add(variable); BTEditorWindow.AddObjectToAsset(variable, owner.template); } EditorUtility.SetDirty(owner); } }
public static BTVariable CreateVariable(Type type, BTFsm parentFsm) { BTVariable variable = XScriptableObject.CreateInstance(type) as BTVariable; variable.Name = type.Name; variable.Owner = parentFsm; parentFsm.totalVariable.Add(variable); AddVarToFsm(parentFsm, variable); return(variable); }
public override void OnAwake() { base.OnAwake(); arg = Fsm.FindVar(arg.Name); }
public override void OnAwake() { base.OnAwake(); variable = Fsm.FindVar(variable.Name); }