Пример #1
0
        private void RemoveAreaBodyFromActiveArea(BaseActiveArea activeArea, AreaBody areaBody)
        {
            // remove it from this AA.
            activeArea.RemoveBody(areaBody);

            // if it's not in any other AA at this point, hibernate it.
            var isActiveAreasContainingBody = this.ActiveAreas.Any(aa =>
                                                                   aa != activeArea && // is a different active area
                                                                   aa.AreaBodies.Select(aab => aab.Body).Contains(areaBody.Body)); // contains the body

            if (!isActiveAreasContainingBody)
            {
                // no other active area has this body in it, so go ahead and hibernate the body
                this.BodiesToHibernate.Add(areaBody.Body);
            }
        }