Пример #1
0
        void ClearInternal(RelationTraitCache self)
        {
            if (IntCollections != null)
            {
                for (var i = 0; i < IntCollections.Count; i++)
                {
                    IntCollections[i] = null;
                }
            }

            if (PoseCollections != null)
            {
                for (var i = 0; i < PoseCollections.Count; i++)
                {
                    PoseCollections[i] = null;
                }
            }

            if (Vector2Collections != null)
            {
                for (var i = 0; i < Vector2Collections.Count; i++)
                {
                    Vector2Collections[i] = null;
                }
            }
        }
Пример #2
0
        bool FindRelationTraits(Relations relations, RelationTraitCache cache)
        {
            if (relations.GetTypeCount(out IRelation <System.Int32>[] intRelations) > 0)
            {
                if (!cache.TryGetType(out List <RelationTraitCache.ChildTraits <System.Int32> > intTraits))
                {
                    return(false);
                }

                if (!FindTraitCollections(IntTraitProvider, intRelations, intTraits))
                {
                    return(false);
                }
            }

            if (relations.GetTypeCount(out IRelation <UnityEngine.Pose>[] poseRelations) > 0)
            {
                if (!cache.TryGetType(out List <RelationTraitCache.ChildTraits <UnityEngine.Pose> > poseTraits))
                {
                    return(false);
                }

                if (!FindTraitCollections(PoseTraitProvider, poseRelations, poseTraits))
                {
                    return(false);
                }
            }

            if (relations.GetTypeCount(out IRelation <UnityEngine.Vector2>[] vector2Relations) > 0)
            {
                if (!cache.TryGetType(out List <RelationTraitCache.ChildTraits <UnityEngine.Vector2> > vector2Traits))
                {
                    return(false);
                }

                if (!FindTraitCollections(Vector2TraitProvider, vector2Relations, vector2Traits))
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #3
0
        bool CheckDestroyedInternal(RelationTraitCache self)
        {
            if (IntCollections != null)
            {
                foreach (var dictionary in IntCollections)
                {
                    if (dictionary == null)
                    {
                        return(true);
                    }
                }
            }

            if (PoseCollections != null)
            {
                foreach (var dictionary in PoseCollections)
                {
                    if (dictionary == null)
                    {
                        return(true);
                    }
                }
            }

            if (Vector2Collections != null)
            {
                foreach (var dictionary in Vector2Collections)
                {
                    if (dictionary == null)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
 bool FindTraitCollections(Relations relations, RelationTraitCache cache)
 {
     cache.Fulfilled = FindRelationTraits(relations, cache);
     return(cache.Fulfilled);
 }