Exemplo n.º 1
0
        public virtual bool CheckPredicates(Agent pAgent)
        {
            if (this.m_attachments == null || this.m_attachments.Count == 0)
            {
                return(true);
            }

            bool lastCombineValue = false;

            for (int i = 0; i < this.m_attachments.Count; ++i)
            {
                AttachmentTask          attchment     = this.m_attachments[i];
                Predicate.PredicateTask predicateTask = attchment as Predicate.PredicateTask;

                if (predicateTask != null)
                {
                    EBTStatus executeStatus = predicateTask.GetStatus();
                    if (executeStatus == EBTStatus.BT_RUNNING || executeStatus == EBTStatus.BT_INVALID)
                    {
                        executeStatus = predicateTask.exec(pAgent);
                    }

                    bool taskBoolean = getBooleanFromStatus(executeStatus);
                    if (i == 0)
                    {
                        lastCombineValue = taskBoolean;
                    }
                    else
                    {
                        bool andOp = predicateTask.IsAnd();
                        if (andOp)
                        {
                            lastCombineValue = lastCombineValue && taskBoolean;
                        }
                        else
                        {
                            lastCombineValue = lastCombineValue || taskBoolean;
                        }
                    }
                }
            }

            return(lastCombineValue);
        }
Exemplo n.º 2
0
        public virtual bool CheckPredicates(Agent pAgent)
        {
            if (this.m_attachments == null || this.m_attachments.Count == 0)
            {
                return(true);
            }
            bool flag = false;

            for (int i = 0; i < this.m_attachments.Count; i++)
            {
                AttachmentTask          attachmentTask = this.m_attachments[i];
                Predicate.PredicateTask predicateTask  = attachmentTask as Predicate.PredicateTask;
                if (predicateTask != null)
                {
                    EBTStatus eBTStatus = predicateTask.GetStatus();
                    if (eBTStatus == EBTStatus.BT_RUNNING || eBTStatus == EBTStatus.BT_INVALID)
                    {
                        eBTStatus = predicateTask.exec(pAgent);
                    }
                    bool booleanFromStatus = this.getBooleanFromStatus(eBTStatus);
                    if (i == 0)
                    {
                        flag = booleanFromStatus;
                    }
                    else
                    {
                        bool flag2 = predicateTask.IsAnd();
                        if (flag2)
                        {
                            flag = (flag && booleanFromStatus);
                        }
                        else
                        {
                            flag = (flag || booleanFromStatus);
                        }
                    }
                }
            }
            return(flag);
        }
Exemplo n.º 3
0
        public virtual bool CheckPredicates(Agent pAgent)
        {
            if ((this.m_attachments == null) || (this.m_attachments.Count == 0))
            {
                return(true);
            }
            bool flag = false;

            for (int i = 0; i < this.m_attachments.Count; i++)
            {
                AttachmentTask          task  = this.m_attachments[i];
                Predicate.PredicateTask task2 = task as Predicate.PredicateTask;
                if (task2 != null)
                {
                    EBTStatus status = task2.GetStatus();
                    switch (status)
                    {
                    case EBTStatus.BT_RUNNING:
                    case EBTStatus.BT_INVALID:
                        status = task2.exec(pAgent);
                        break;
                    }
                    bool flag2 = this.getBooleanFromStatus(status);
                    if (i == 0)
                    {
                        flag = flag2;
                    }
                    else if (task2.IsAnd())
                    {
                        flag = flag && flag2;
                    }
                    else
                    {
                        flag = flag || flag2;
                    }
                }
            }
            return(flag);
        }