Example #1
0
    void RemoveParentBundles(EgoConstraint childConstraint, EgoComponent childEgoComponent)
    {
        var parentConstraint   = childConstraint.parentConstraint;
        var parentEgoComponent = childEgoComponent.parent;

        if (parentConstraint != null && parentEgoComponent != null && parentConstraint.childBundles.ContainsKey(parentEgoComponent))
        {
            parentConstraint.childBundles[parentEgoComponent].Remove(childEgoComponent);
            if (parentConstraint.childBundles[parentEgoComponent].Count <= 0)
            {
                parentConstraint.childBundles.Remove(parentEgoComponent);
            }

            RemoveParentBundles(parentConstraint, parentEgoComponent);
        }
    }
Example #2
0
 void RemoveChildBundles(EgoConstraint constraint, EgoComponent egoComponent)
 {
     if (constraint.childBundles.ContainsKey(egoComponent))
     {
         if (constraint.childConstraint != null)
         {
             var lookup = constraint.childBundles[egoComponent];
             foreach (var childEgoComponent in lookup.Keys)
             {
                 RemoveChildBundles(constraint.childConstraint, childEgoComponent);
             }
             lookup.Clear();
         }
         else
         {
             constraint.childBundles.Remove(egoComponent);
         }
     }
 }