Пример #1
0
 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);
     }
 }
Пример #2
0
        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);
        }
Пример #3
0
 public override void OnAwake()
 {
     base.OnAwake();
     arg = Fsm.FindVar(arg.Name);
 }
Пример #4
0
 public override void OnAwake()
 {
     base.OnAwake();
     variable = Fsm.FindVar(variable.Name);
 }