internal QualifierVisualizer(IQualifier q, SelectorVisualizer parent)
        {
            this._qualifier = q;
            this._parent    = parent;
            SelectorAction      selectorAction     = q.action as SelectorAction;
            AILinkAction        aILinkAction       = q.action as AILinkAction;
            CompositeAction     compositeAction    = q.action as CompositeAction;
            IRequireTermination requireTermination = q.action as IRequireTermination;

            if (selectorAction != null)
            {
                this._action = new SelectorActionVisualizer(selectorAction, this);
                return;
            }
            if (aILinkAction != null)
            {
                this._action = new AILinkActionVisualizer(aILinkAction, this);
                return;
            }
            if (compositeAction != null)
            {
                this._action = new CompositeActionVisualizer(compositeAction, this);
                return;
            }
            if (requireTermination != null)
            {
                this._action = new ActionRequiresTerminationVisualizer(q.action, this);
                return;
            }
            if (q.action != null)
            {
                this._action = new ActionVisualizer(q.action, this);
            }
        }
        internal UtilityAIVisualizer(IUtilityAI ai)
        {
            _ai = ai;

            var selectorCount = ai.selectorCount;

            _selectorVisualizers = new List <SelectorVisualizer>(ai.selectorCount);
            for (int i = 0; i < selectorCount; i++)
            {
                var selector           = _ai[i];
                var selectorVisualizer = new SelectorVisualizer(selector, this);
                _selectorVisualizers.Add(selectorVisualizer);

                if (object.ReferenceEquals(selector, _ai.rootSelector))
                {
                    _visualizerRootSelector = selectorVisualizer;
                }
            }

            for (int i = 0; i < selectorCount; i++)
            {
                _selectorVisualizers[i].Init();
            }

            _postExecute = new List <Action>(1);
        }
Exemple #3
0
        internal QualifierVisualizer(IQualifier q, SelectorVisualizer parent)
        {
            _qualifier = q;
            _parent    = parent;

            var selectorAction = q.action as SelectorAction;
            var linkAction     = q.action as AILinkAction;
            var compAction     = q.action as CompositeAction;
            var irt            = q.action as IRequireTermination;

            if (selectorAction != null)
            {
                _action = new SelectorActionVisualizer(selectorAction, this);
            }
            else if (linkAction != null)
            {
                _action = new AILinkActionVisualizer(linkAction, this);
            }
            else if (compAction != null)
            {
                _action = new CompositeActionVisualizer(compAction, this);
            }
            else if (irt != null)
            {
                _action = new ActionRequiresTerminationVisualizer(q.action, this);
            }
            else if (q.action != null)
            {
                _action = new ActionVisualizer(q.action, this);
            }
        }
Exemple #4
0
 internal CompositeQualifierVisualizer(ICompositeScorer q, SelectorVisualizer parent) : base((IQualifier)q, parent)
 {
     this._scorers = new List <IContextualScorer>(q.scorers.Count);
     for (int i = 0; i < q.scorers.Count; i++)
     {
         this._scorers.Add(new ScorerVisualizer(q.scorers[i], this));
     }
 }
 internal CompositeQualifierVisualizer(ICompositeScorer q, SelectorVisualizer parent)
     : base((IQualifier)q, parent)
 {
     _scorers = new List <IContextualScorer>(q.scorers.Count);
     foreach (var s in q.scorers)
     {
         _scorers.Add(new ScorerVisualizer(s, this));
     }
 }
        internal IQualifierVisualizer FindQualifierVisualizer(IQualifier target)
        {
            int count = this._selectorVisualizers.Count;

            for (int i = 0; i < count; i++)
            {
                SelectorVisualizer item = this._selectorVisualizers[i];
                int num = item.qualifiers.Count;
                for (int j = 0; j < num; j++)
                {
                    IQualifierVisualizer qualifierVisualizer = (IQualifierVisualizer)item.qualifiers[j];
                    if (qualifierVisualizer.qualifier == target)
                    {
                        return(qualifierVisualizer);
                    }
                }
            }
            return(null);
        }
        internal UtilityAIVisualizer(IUtilityAI ai)
        {
            this._ai = ai;
            int num = ai.selectorCount;

            this._selectorVisualizers = new List <SelectorVisualizer>(ai.selectorCount);
            for (int i = 0; i < num; i++)
            {
                Selector           item = this._ai[i];
                SelectorVisualizer selectorVisualizer = new SelectorVisualizer(item, this);
                this._selectorVisualizers.Add(selectorVisualizer);
                if (item == this._ai.rootSelector)
                {
                    this._visualizerRootSelector = selectorVisualizer;
                }
            }
            for (int j = 0; j < num; j++)
            {
                this._selectorVisualizers[j].Init();
            }
            this._postExecute = new List <Action>(1);
        }
        internal ActionVisualizer FindActionVisualizer(IAction target)
        {
            ActionVisualizer actionVisualizer = null;
            int count = this._selectorVisualizers.Count;

            for (int i = 0; i < count; i++)
            {
                SelectorVisualizer item = this._selectorVisualizers[i];
                int num = item.qualifiers.Count;
                for (int j = 0; j < num; j++)
                {
                    if (UtilityAIVisualizer.TryFindActionVisualizer(((IQualifierVisualizer)item.qualifiers[j]).action, target, out actionVisualizer))
                    {
                        return(actionVisualizer);
                    }
                }
                if (UtilityAIVisualizer.TryFindActionVisualizer(item.defaultQualifier.action, target, out actionVisualizer))
                {
                    return(actionVisualizer);
                }
            }
            return(null);
        }
Exemple #9
0
 internal DefaultQualifierVisualizer(IDefaultQualifier q, SelectorVisualizer parent) : base(q, parent)
 {
     this._defQualifier = q;
 }