Exemple #1
0
 public virtual float Score(IAIContext context, IList<IContextualScorer> scorers)
 {
   float num1 = 0.0f;
   int count = ((ICollection<IContextualScorer>) scorers).Count;
   for (int index = 0; index < count; ++index)
   {
     IContextualScorer scorer = scorers[index];
     if (!((ICanBeDisabled) scorer).get_isDisabled())
     {
       float num2 = scorer.Score(context);
       if ((double) num2 < 0.0)
       {
         Debug.LogWarning((object) "SumMustBeAboveThreshold scorer does not support scores below 0!");
       }
       else
       {
         num1 += num2;
         if ((double) num1 > (double) this.threshold)
           break;
       }
     }
   }
   if ((double) num1 <= (double) this.threshold)
     return 0.0f;
   return num1;
 }
Exemple #2
0
        public sealed override float Score(IAIContext context, IList <IContextualScorer> scorers)
        {
            float num   = 0f;
            int   count = scorers.Count;

            for (int i = 0; i < count; i++)
            {
                IContextualScorer contextualScorer = scorers[i];
                if (contextualScorer.isDisabled)
                {
                    continue;
                }
                float num2 = contextualScorer.Score(context);
                if (num2 < 0f)
                {
                    Debug.LogWarning("SumMustBeAboveThreshold scorer does not support scores below 0!");
                    continue;
                }
                num += num2;
                if (num > threshold)
                {
                    break;
                }
            }
            if (num <= threshold)
            {
                return(0f);
            }
            return(num);
        }
Exemple #3
0
        public sealed override float Score(IAIContext context, IList <IContextualScorer> scorers)
        {
            float single = 0f;
            int   count  = scorers.Count;

            for (int i = 0; i < count; i++)
            {
                IContextualScorer item = scorers[i];
                if (!item.isDisabled)
                {
                    float single1 = item.Score(context);
                    if (single1 >= 0f)
                    {
                        single += single1;
                        if (single > this.threshold)
                        {
                            break;
                        }
                    }
                    else
                    {
                        Debug.LogWarning("SumMustBeAboveThreshold scorer does not support scores below 0!");
                    }
                }
            }
            if (single <= this.threshold)
            {
                return(0f);
            }
            return(single);
        }
Exemple #4
0
        void Apex.AI.Visualization.ICompositeVisualizer.Add(object item)
        {
            IContextualScorer contextualScorer = item as IContextualScorer;

            if (contextualScorer == null)
            {
                return;
            }
            this._scorers.Add(new ScorerVisualizer(contextualScorer, this));
        }
Exemple #5
0
        public sealed override bool Validate(IHTNContext context, IList <IContextualScorer> scorers)
        {
            int count = scorers.Count;

            for (int i = 0; i < count; i++)
            {
                IContextualScorer item = scorers[i];
                if (!item.isDisabled && item.CanInvalidatePlan && item.Score(context) <= this.threshold)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #6
0
        public sealed override float Score(IAIContext context, IList <IContextualScorer> scorers)
        {
            float single = 0f;
            int   count  = scorers.Count;

            for (int i = 0; i < count; i++)
            {
                IContextualScorer item = scorers[i];
                if (!item.isDisabled)
                {
                    single += item.Score(context);
                }
            }
            return(single);
        }
Exemple #7
0
 internal ScorerVisualizer(IContextualScorer scorer, CompositeQualifierVisualizer parent)
 {
     this._scorer = scorer;
     this._parent = parent;
 }