internal CompositeActionVisualizer(CompositeAction action, IQualifierVisualizer parent) : base(action, parent)
        {
            this._actions = new List <ActionVisualizer>(action.actions.Count);
            for (int i = 0; i < action.actions.Count; i++)
            {
                IAction         item            = action.actions[i];
                CompositeAction compositeAction = item as CompositeAction;
                if (compositeAction == null)
                {
                    this._actions.Add(new ActionVisualizer(item, parent));
                }
                else
                {
                    this._actions.Add(new CompositeActionVisualizer(compositeAction, parent));
                }
            }
            SelectorAction selectorAction = action.connectorAction as SelectorAction;
            AILinkAction   aILinkAction   = action.connectorAction as AILinkAction;

            if (selectorAction != null)
            {
                this._connectorAction = new SelectorActionVisualizer(selectorAction, parent);
                return;
            }
            if (aILinkAction != null)
            {
                this._connectorAction = new AILinkActionVisualizer(aILinkAction, parent);
            }
        }
        internal CompositeActionVisualizer(CompositeAction action, IQualifierVisualizer parent)
            : base(action, parent)
        {
            _actions = new List <ActionVisualizer>(action.actions.Count);
            foreach (var a in action.actions)
            {
                var ca = a as CompositeAction;
                if (ca != null)
                {
                    _actions.Add(new CompositeActionVisualizer(ca, parent));
                }
                else
                {
                    _actions.Add(new ActionVisualizer(a, parent));
                }
            }

            var sa = action.connectorAction as SelectorAction;
            var la = action.connectorAction as AILinkAction;

            if (sa != null)
            {
                _connectorAction = new SelectorActionVisualizer(sa, parent);
            }
            else if (la != null)
            {
                _connectorAction = new AILinkActionVisualizer(la, parent);
            }
        }
        internal static BreakpointConditionWindow Open(Vector2 screenPosition, IQualifierVisualizer qv)
        {
            var host = EditorWindow.focusedWindow;
            var win  = EditorWindow.GetWindow <BreakpointConditionWindow>(true, "Breakpoint Condition", false);

            win.Init(screenPosition, qv, host);
            win.Show();
            win.Focus();
            return(win);
        }
Beispiel #4
0
        public override IQualifier Select(IAIContext context, IList <IQualifier> qualifiers, IDefaultQualifier defaultQualifier)
        {
            this.lastSelectedQualifier = this._selector.Select(context, qualifiers, defaultQualifier);
            IQualifierVisualizer qualifierVisualizer = this.lastSelectedQualifier as IQualifierVisualizer;

            if (qualifierVisualizer != null && qualifierVisualizer.isBreakPoint)
            {
                if (qualifierVisualizer.breakpointCondition == null)
                {
                    qualifierVisualizer.breakPointHit = true;
                }
                else
                {
                    qualifierVisualizer.breakPointHit = qualifierVisualizer.breakpointCondition.Evaluate(qualifierVisualizer.lastScore);
                }
            }
            return(this.lastSelectedQualifier);
        }
        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);
        }
        private void Init(Vector2 screenPosition, IQualifierVisualizer qv, EditorWindow host)
        {
            this.minSize = new Vector2(210f, 50f);
            this.maxSize = new Vector2(230f, 80f);

            var winRect = this.position;

            winRect.size  = new Vector2(220f, 60f);
            this.position = PopupConstraints.GetValidPosition(winRect, screenPosition, host);

            _qv        = qv;
            _condition = new BreakpointCondition();
            var current = qv.breakpointCondition;

            if (current != null)
            {
                _condition.compareOperator = current.compareOperator;
                _condition.scoreThreshold  = current.scoreThreshold;
            }
        }
Beispiel #7
0
 internal ActionRequiresTerminationVisualizer(IAction action, IQualifierVisualizer parent) : base(action, parent)
 {
     this._action = (IRequireTermination)action;
 }
 internal ActionVisualizer(IAction action, IQualifierVisualizer parent)
 {
     this._action = action;
     this._parent = parent;
 }
Beispiel #9
0
 internal SelectorActionVisualizer(SelectorAction action, IQualifierVisualizer parent)
     : base(action, parent)
 {
 }
 internal ConnectorActionVisualizer(IAction action, IQualifierVisualizer parent) : base(action, parent)
 {
 }
 internal AILinkActionVisualizer(AILinkAction action, IQualifierVisualizer parent)
     : base(action, parent)
 {
 }