示例#1
0
        public static BehaviourTree TrySelectedObjectDebugging(string treeUid)
        {
            if (Selection.activeObject == null || (Selection.activeObject as GameObject) == null)
            {
                return(null);
            }

            BevComponent bcom = (Selection.activeObject as GameObject).GetComponent <BevComponent>();

            if (bcom == null)
            {
                return(null);
            }

            BehaviourTree tree;
            Context       cntx;

            bcom.FindAttachedBevTree(treeUid, out tree, out cntx);
            // find a tree instance, so set current debug data.
            if (tree != null)
            {
                CurrentDebugRootTree = tree;
                DebugContext         = cntx;
            }

            return(tree);
        }
示例#2
0
        /// <summary>
        /// check if current select scene object is BevComponent. if yes then open the bev tree as debug mode.
        /// </summary>
        public static bool CheckDebugOpen(string treeGuid, out BehaviourTree btInstance)
        {
            btInstance = null;

            if (!EditorApplication.isPlaying)
            {
                return(false);
            }

            if (Selection.activeObject == null || (Selection.activeObject as GameObject) == null)
            {
                return(false);
            }

            BevComponent agent = (Selection.activeObject as GameObject).GetComponent <BevComponent>();

            if (agent == null)
            {
                return(false);
            }

            btInstance = TrySelectedObjectDebugging(treeGuid);

            return(btInstance != null);
        }