Exemple #1
0
            protected override void OnAssert()
            {
                if (this.tree == null)
                {
                    this.tree           = new StratusSerializedTree <BehaviorNode, StratusAIBehavior>();
                    this.tree.root.data = StratusAIBehavior.Instantiate(typeof(StratusAISequence));
                }

                try
                {
                    this.tree.Assert();
                }
                catch (Exception e)
                {
                    StratusDebug.Log($"The tree {name} is damaged: '{e.Message}'. Attempting to repair...");
                    this.tree.Repair();

                    // Try again

                    try
                    {
                        this.tree.Assert();
                    }
                    catch (Exception e2)
                    {
                        StratusDebug.Log($"The tree {name} is damaged: '{e.Message}'");
                        throw e2;
                    }
                }
            }
Exemple #2
0
        //----------------------------------------------------------------------/
        // Messages
        //----------------------------------------------------------------------/
        protected override void OnWindowEnable()
        {
            if (this.treeViewState == null)
            {
                this.treeViewState = new TreeViewState();
            }

            if (this.behaviorTree)
            {
                this.treeInspector = new BehaviourTreeView(this.treeViewState, this.behaviorTree.tree.elements);
                this.OnTreeSet();
            }
            else
            {
                //TreeBuilder<BehaviorTree.BehaviorNode, Behavior> treeBuilder = new TreeBuilder<BehaviorTree.BehaviorNode, Behavior>();
                var tree = new StratusSerializedTree <BehaviorTree.BehaviorNode, StratusAIBehavior>();

                this.treeInspector = new BehaviourTreeView(this.treeViewState, tree.elements);
            }

            this.treeInspector.onSelectionIdsChanged += this.OnSelectionChanged;
            this.treeInspector.Reload();
        }