Example #1
0
        public static void AddActionToState(BTState Owner, BTAction action)
        {
            var Fsm = Owner.Owner;

            if (BTEditorWindow.HasPrefab(Fsm))
            {
                if (Fsm.template == null)
                {
                    AddTemplateToFsm(Fsm);
                    Fsm.template.startEvent = Fsm.startEvent;
                    Fsm.template.totalEvent = Fsm.totalEvent;
                }
                BTEditorWindow.AddObjectToAsset(action, Owner);
            }
            EditorUtility.SetDirty(Fsm);
        }
Example #2
0
        public static void AddActionToState(BTState Owner, BTAction action)
        {
            var Fsm = Owner.Owner;

            if (BTEditorWindow.HasPrefab(Fsm))
            {
                if (Fsm.template == null)
                {
                    Fsm.template = XScriptableObject.CreateInstance <BTTemplate> ();
                    BTEditorWindow.AddObjectToAsset(Fsm.template, Fsm.gameObject);
                    EditorUtility.SetDirty(Fsm);
                    Fsm.template.startEvent = Fsm.startEvent;
                    Fsm.template.totalEvent = Fsm.totalEvent;
                }
                BTEditorWindow.AddObjectToAsset(action, Owner);
            }
            EditorUtility.SetDirty(Fsm);
        }