Пример #1
0
        public override string getTreeAsString(string prefix)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(base.getTreeAsString(prefix));
            prefix += treePrefix;
            builder.Append(childNode.getTreeAsString(prefix));
            return(builder.ToString());
        }
Пример #2
0
    IEnumerator TickTree(string inputval, System.Action <BehaviourTreeStatus, string> callback)
    {
        while (continueBehaviourTree)
        {
            done = false;
            Log("\n\n");
            callData = new Dictionary <string, string>();
            Log("============> Beginning of TickTree(): input Value=" + inputval + " ---> Loop Number: " + numloops);

            int numticks = 0;
            for (var e = btree1.Tick(new TimeData(Time.deltaTime)); e.MoveNext();)
            {
                ++numticks;
                yield return(e.Current);

                callback(e.Current, "Callback Called From TickTree() - Tick Number=" + numticks + " --> Behavior Status=" + e.Current);
            }

            Log("End of TickTree() - Done=true");
            done = true;

            Log("--> Tree Hierarchy after:");
            Log(btree1.getTreeAsString(" --> "));

            Log("--> Tree Hierarchy Reset:");
            btree1.SetStatusAll(BehaviourTreeStatus.Initial);
            Log(btree1.getTreeAsString(" --> "));

            Debug.Log(report);
            report = "";
            ++numloops;
            if (numloops > maxloops)
            {
                continueBehaviourTree = false;
                break;
            }
            yield return(new WaitForSeconds(2));
        }
        yield return(null);
    }