From a72f54270dc666a7aae2b4963eac604e4d9e1542 Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Fri, 22 Dec 2023 23:25:31 +0800 Subject: [PATCH] Update EcsGroup.cs --- src/EcsGroup.cs | 66 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 6 deletions(-) diff --git a/src/EcsGroup.cs b/src/EcsGroup.cs index 7542435..65c1fb5 100644 --- a/src/EcsGroup.cs +++ b/src/EcsGroup.cs @@ -342,9 +342,9 @@ namespace DCFApixels.DragonECS AddInternal(item); } } - public void UnionWithRange(IEnumerable otherRange) + public void UnionWithRange(IEnumerable range) { - foreach (var item in otherRange) + foreach (var item in range) { if (!Has(item)) AddInternal(item); @@ -408,12 +408,12 @@ namespace DCFApixels.DragonECS RemoveInternal(item); } } - public void ExceptWithRange(IEnumerable otherRange) + public void ExceptWithRange(IEnumerable range) { - foreach (var item in otherRange) + foreach (var item in range) { - if (!Has(item)) - AddInternal(item); + if (Has(item)) + RemoveInternal(item); } } #endregion @@ -720,4 +720,58 @@ namespace DCFApixels.DragonECS } #endregion } + +#if false + public static class EcsGroupAliases + { + /// Alias for UnionWith + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Add(this EcsGroup self, EcsGroup group) + { + self.UnionWith(group); + } + /// Alias for UnionWith + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Add(this EcsGroup self, EcsReadonlyGroup group) + { + self.UnionWith(group); + } + /// Alias for ExceptWith + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Remove(this EcsGroup self, EcsGroup group) + { + self.ExceptWith(group); + } + /// Alias for ExceptWith + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Remove(this EcsGroup self, EcsReadonlyGroup group) + { + self.ExceptWith(group); + } + /// Alias for SymmetricExceptWith + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Xor(this EcsGroup self, EcsGroup group) + { + self.SymmetricExceptWith(group); + } + /// Alias for SymmetricExceptWith + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void Xor(this EcsGroup self, EcsReadonlyGroup group) + { + self.SymmetricExceptWith(group); + } + /// Alias for IntersectWith + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void And(this EcsGroup self, EcsGroup group) + { + self.IntersectWith(group); + } + /// Alias for IntersectWith + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void And(this EcsGroup self, EcsReadonlyGroup group) + { + self.IntersectWith(group); + } + } +#endif } \ No newline at end of file