Ejemplo n.º 1
0
 protected void SetupOneToManyRelationship(OneToManyRelationship oneToMany, string ownerEntityId, string subjectEntityId, List <string> objectEntitiesId)
 {
     oneToMany.subjectEntity  = entityObjects[subjectEntityId].GetComponent <EntityData>();
     oneToMany.objectEntities = new List <EntityData>(objectEntitiesId.Count);
     foreach (string id in objectEntitiesId)
     {
         oneToMany.objectEntities.Add(entityObjects[id].GetComponent <EntityData>());
     }
     // update cross references
     oneToMany.OnValidate();
 }
Ejemplo n.º 2
0
        public static void IncludeChildrenInRelationship(OneToManyRelationship rel)
        {
            GameObject selObj = rel.gameObject;

            if (rel.objectEntities == null)
            {
                rel.objectEntities = new List <EntityData>();
            }
            for (int i = 0; i < selObj.transform.childCount; i++)
            {
                var childEntity = selObj.transform.GetChild(i).gameObject.GetComponent <EntityData>();
                if (childEntity)
                {
                    rel.objectEntities.Add(childEntity);
                }
            }
            rel.OnValidate();
        }