public int RevealGroup(ConcealGroup group) { if (!group.IsConcealed) { Log.Warn($"Attempted to reveal a group that wasn't concealed: {group.GridNames}"); Log.Warn(new StackTrace()); return(0); } var count = group.Grids.Count; Log.Debug($"Revealing grids: {group.GridNames}"); group.Reveal(); foreach (var entity in group.Grids) { entity.GetStorage().SetValue(Id, "False"); } ConcealedGroups.Remove(group); _concealedAabbTree.RemoveProxy(group.ProxyId); group.UpdatePostReveal(); return(count); }
private int ConcealGroup(ConcealGroup group) { if (ConcealedGroups.Any(g => g.Id == group.Id)) { return(0); } Log.Debug($"Concealing grids: {group.GridNames}"); group.Grids.ForEach(ConcealEntity); group.UpdateAABB(); var aabb = group.WorldAABB; group.ProxyId = _concealedAabbTree.AddProxy(ref aabb, group, 0); group.Closing += Group_Closing; Task.Run(() => { group.UpdatePostConceal(); Log.Debug($"Group {group.Id} cached"); group.IsConcealed = true; Torch.Invoke(() => ConcealedGroups.Add(group)); }); return(group.Grids.Count); }
private void Group_Closing(ConcealGroup group) { RevealGroup(group); }