Beispiel #1
0
 public SetChildArgs(ProxyConditions conditions, Exclusivity exclusivity, bool required,
                     ProxyTraitRequirements requirements = null)
 {
     this.required     = required;
     tryBestMatchArgs  = new TryBestMatchArguments(conditions, exclusivity);
     TraitRequirements = requirements;
 }
Beispiel #2
0
        bool DataHasAllTraitRequirements(int dataId, ProxyTraitRequirements traitRequirements)
        {
            k_TempFilterSet.Clear();
            k_TempFilterSet.Add(dataId);

            foreach (var trait in traitRequirements)
            {
                if (m_Database.TypeToFilterAction.TryGetValue(trait.Type, out var filterAction))
                {
                    filterAction.Invoke(trait.TraitName, k_TempFilterSet);
                    if (k_TempFilterSet.Count == 0)
                    {
                        return(false);
                    }
                }
            }

            return(k_TempFilterSet.Count == 1);
        }
        internal void FillQueryResult(int dataId, ProxyConditions conditions, CachedTraitCollection traits,
                                      ProxyTraitRequirements requirements, QueryMatchID matchId, QueryResult result)
        {
            result.queryMatchId = matchId;
            result.SetDataId(dataId);

            FillRequiredTraitsAction(dataId, requirements, result);

            FillQueryResultInternal(dataId, conditions, traits, matchId, result);

            conditions.TryGetType(out ICondition <Pose>[] poseConditions);
            traits.TryGetType(out List <Dictionary <int, Pose> > poseCollections);

            for (var i = 0; i < poseConditions.Length; i++)
            {
                var poseCollection = poseCollections[i];
                var nonOffsetValue = poseCollection[dataId];
                var poseValue      = applyOffsetToPose(nonOffsetValue);
                var refiner        = poseConditions[i] as IPoseRefiner;
                if (refiner != null)
                {
                    poseValue = refiner.RefinePose(poseValue, true);
                }
                result.SetTrait(poseConditions[i].traitName, poseValue);
            }

            if (!conditions.TryGetType(out ISemanticTagCondition[] semanticTagConditions))
            {
                return;
            }

            // tags can take a shortcut with query filling - they're really just a test for presence or absence,
            // so if that test has already been passed, we can just assign a bool representing the result
            foreach (var condition in semanticTagConditions)
            {
                var isExcluding = condition.matchRule == SemanticTagMatchRule.Exclude;
                result.SetTrait(condition.traitName, !isExcluding);
            }
        }
Beispiel #4
0
 public SetChildArgs(ProxyConditions conditions, ProxyTraitRequirements requirements = null) :
     this(conditions, Exclusivity.ReadOnly, true, requirements)
 {
 }