/**
         * Creates a new empty context (with no variables) that contains all the
         * behaviour trees specified in <code>library</code>.
         *
         * @param library
         *            the set of behaviour trees that the returned IContext will
         *            contain.
         * @return a new empty context that contains all the behaviour trees
         *         specified in <code>library</code>.
         */
        public static IContext CreateContext(IBTLibrary library)
        {
            var result = new BasicContext();

            result.AddBTLibrary(library);
            return(result);
        }
        /**
         * Adds all the behaviour trees in <code>library</code> to the set of
         * behaviour trees stored in this library. If there is already a tree with
         * the same name as that of one of the trees in <code>library</code>, it is
         * overwritten.
         *
         * @param library
         *            the library containing all the behaviour trees to add to this
         *            library.
         * @return true if a previously stored behaviour tree has been overwritten,
         *         and false otherwise.
         */
        public bool AddBTLibrary(IBTLibrary library)
        {
            if (library == null)
                return false;

            var overwritten = false;

            foreach (var tuple in library.GetAllTrees())
            {
                if(AddBT(tuple.Key, tuple.Value))
                    overwritten = true;
            }

            return overwritten;
        }
        /**
         * Adds all the behaviour trees in <code>library</code> to the set of
         * behaviour trees stored in this library. If there is already a tree with
         * the same name as that of one of the trees in <code>library</code>, it is
         * overwritten.
         *
         * @param library
         *            the library containing all the behaviour trees to add to this
         *            library.
         * @return true if a previously stored behaviour tree has been overwritten,
         *         and false otherwise.
         */

        public bool AddBTLibrary(IBTLibrary library)
        {
            if (library == null)
            {
                return(false);
            }

            var overwritten = false;

            foreach (var tuple in library.GetAllTrees())
            {
                if (AddBT(tuple.Key, tuple.Value))
                {
                    overwritten = true;
                }
            }

            return(overwritten);
        }
Exemplo n.º 4
0
 /**
  * Adds all the behaviour trees in <code>library</code> to the set of
  * behaviour trees stored in the context. If there is already a tree with
  * the same name as that of one of the trees in <code>library</code>, it is
  * overwritten.
  *
  * @param library
  *            the library containing all the behaviour trees to add to this
  *            context.
  * @return true if a previously stored behaviour tree has been overwritten,
  *         and false otherwise.
  */
 public bool AddBTLibrary(IBTLibrary library)
 {
     return _library.AddBTLibrary(library);
 }
Exemplo n.º 5
0
        /**
         * Adds all the behaviour trees in <code>library</code> to the set of
         * behaviour trees stored in the context. If there is already a tree with
         * the same name as that of one of the trees in <code>library</code>, it is
         * overwritten.
         *
         * @param library
         *            the library containing all the behaviour trees to add to this
         *            context.
         * @return true if a previously stored behaviour tree has been overwritten,
         *         and false otherwise.
         */

        public bool AddBTLibrary(IBTLibrary library)
        {
            return(_library.AddBTLibrary(library));
        }
 /**
  * Creates a new empty context (with no variables) that contains all the
  * behaviour trees specified in <code>library</code>.
  *
  * @param library
  *            the set of behaviour trees that the returned IContext will
  *            contain.
  * @return a new empty context that contains all the behaviour trees
  *         specified in <code>library</code>.
  */
 public static IContext CreateContext(IBTLibrary library)
 {
     var result = new BasicContext();
     result.AddBTLibrary(library);
     return result;
 }