2023-02-07 17:11:56 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
|
|
|
|
|
namespace DCFApixels.DragonECS
|
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
#region Incs/Excs base
|
|
|
|
|
public interface ICondition
|
2023-02-07 17:11:56 +08:00
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public int[] GetComponentsIDs();
|
2023-02-07 17:11:56 +08:00
|
|
|
|
}
|
2023-02-14 03:26:34 +08:00
|
|
|
|
#endregion
|
2023-02-13 21:11:54 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
#region Incs
|
|
|
|
|
public interface IInc : ICondition { }
|
2023-02-13 21:11:54 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public struct Inc<T0> : IInc
|
2023-02-13 21:11:54 +08:00
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
2023-02-13 21:11:54 +08:00
|
|
|
|
}
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public struct Inc<T0, T1> : IInc
|
2023-02-13 21:11:54 +08:00
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
2023-02-13 21:11:54 +08:00
|
|
|
|
}
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public struct Inc<T0, T1, T2> : IInc
|
2023-02-13 21:11:54 +08:00
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
2023-02-13 21:11:54 +08:00
|
|
|
|
}
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public struct Inc<T0, T1, T2, T3> : IInc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID,
|
|
|
|
|
ComponentType<T3>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Inc<T0, T1, T2, T3, T4> : IInc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID,
|
|
|
|
|
ComponentType<T3>.globalID,
|
|
|
|
|
ComponentType<T4>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Inc<T0, T1, T2, T3, T4, T5> : IInc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID,
|
|
|
|
|
ComponentType<T3>.globalID,
|
|
|
|
|
ComponentType<T4>.globalID,
|
|
|
|
|
ComponentType<T5>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Inc<T0, T1, T2, T3, T4, T5, T6> : IInc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID,
|
|
|
|
|
ComponentType<T3>.globalID,
|
|
|
|
|
ComponentType<T4>.globalID,
|
|
|
|
|
ComponentType<T5>.globalID,
|
|
|
|
|
ComponentType<T6>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Inc<T0, T1, T2, T3, T4, T5, T6, T7> : IInc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID,
|
|
|
|
|
ComponentType<T3>.globalID,
|
|
|
|
|
ComponentType<T4>.globalID,
|
|
|
|
|
ComponentType<T5>.globalID,
|
|
|
|
|
ComponentType<T6>.globalID,
|
|
|
|
|
ComponentType<T7>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Inc<T0, T1, T2, T3, T4, T5, T6, T7, T8> : IInc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID,
|
|
|
|
|
ComponentType<T3>.globalID,
|
|
|
|
|
ComponentType<T4>.globalID,
|
|
|
|
|
ComponentType<T5>.globalID,
|
|
|
|
|
ComponentType<T6>.globalID,
|
|
|
|
|
ComponentType<T7>.globalID,
|
|
|
|
|
ComponentType<T8>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Inc<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> : IInc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID,
|
|
|
|
|
ComponentType<T3>.globalID,
|
|
|
|
|
ComponentType<T4>.globalID,
|
|
|
|
|
ComponentType<T5>.globalID,
|
|
|
|
|
ComponentType<T6>.globalID,
|
|
|
|
|
ComponentType<T7>.globalID,
|
|
|
|
|
ComponentType<T8>.globalID,
|
|
|
|
|
ComponentType<T9>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Inc<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> : IInc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID,
|
|
|
|
|
ComponentType<T3>.globalID,
|
|
|
|
|
ComponentType<T4>.globalID,
|
|
|
|
|
ComponentType<T5>.globalID,
|
|
|
|
|
ComponentType<T6>.globalID,
|
|
|
|
|
ComponentType<T7>.globalID,
|
|
|
|
|
ComponentType<T8>.globalID,
|
|
|
|
|
ComponentType<T9>.globalID,
|
|
|
|
|
ComponentType<T10>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Inc<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> : IInc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID,
|
|
|
|
|
ComponentType<T3>.globalID,
|
|
|
|
|
ComponentType<T4>.globalID,
|
|
|
|
|
ComponentType<T5>.globalID,
|
|
|
|
|
ComponentType<T6>.globalID,
|
|
|
|
|
ComponentType<T7>.globalID,
|
|
|
|
|
ComponentType<T8>.globalID,
|
|
|
|
|
ComponentType<T9>.globalID,
|
|
|
|
|
ComponentType<T10>.globalID,
|
|
|
|
|
ComponentType<T11>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2023-02-13 21:11:54 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
#region Excs
|
|
|
|
|
public interface IExc : ICondition { }
|
2023-02-13 21:11:54 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public struct Exc<T0> : IExc
|
2023-02-07 17:11:56 +08:00
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Exc<T0, T1> : IExc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Exc<T0, T1, T2> : IExc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Exc<T0, T1, T2, T3> : IExc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID,
|
|
|
|
|
ComponentType<T3>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Exc<T0, T1, T2, T3, T4> : IExc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID,
|
|
|
|
|
ComponentType<T3>.globalID,
|
|
|
|
|
ComponentType<T4>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Exc<T0, T1, T2, T3, T4, T5> : IExc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID,
|
|
|
|
|
ComponentType<T3>.globalID,
|
|
|
|
|
ComponentType<T4>.globalID,
|
|
|
|
|
ComponentType<T5>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Exc<T0, T1, T2, T3, T4, T5, T6> : IExc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID,
|
|
|
|
|
ComponentType<T3>.globalID,
|
|
|
|
|
ComponentType<T4>.globalID,
|
|
|
|
|
ComponentType<T5>.globalID,
|
|
|
|
|
ComponentType<T6>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public struct Exc<T0, T1, T2, T3, T4, T5, T6, T7> : IExc
|
|
|
|
|
{
|
|
|
|
|
public int[] GetComponentsIDs()
|
|
|
|
|
{
|
|
|
|
|
return new int[]
|
|
|
|
|
{
|
2023-02-27 18:16:23 +08:00
|
|
|
|
ComponentType<T0>.globalID,
|
|
|
|
|
ComponentType<T1>.globalID,
|
|
|
|
|
ComponentType<T2>.globalID,
|
|
|
|
|
ComponentType<T3>.globalID,
|
|
|
|
|
ComponentType<T4>.globalID,
|
|
|
|
|
ComponentType<T5>.globalID,
|
|
|
|
|
ComponentType<T6>.globalID,
|
|
|
|
|
ComponentType<T7>.globalID
|
2023-02-14 03:26:34 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2023-02-07 17:11:56 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
#region Masks
|
|
|
|
|
public abstract class Mask
|
|
|
|
|
{
|
|
|
|
|
protected internal static int _typeIDIncrement = 0;
|
2023-02-07 17:11:56 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
internal abstract int[] Include { get; }
|
|
|
|
|
internal abstract int[] Exclude { get; }
|
2023-02-07 17:11:56 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public abstract int ID { get; }
|
2023-02-07 17:11:56 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public int IncCount
|
2023-02-07 17:11:56 +08:00
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
get => Include.Length;
|
2023-02-07 17:11:56 +08:00
|
|
|
|
}
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public int ExcCount
|
|
|
|
|
{
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
get => Exclude.Length;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public sealed class Mask<TInc> : Mask
|
|
|
|
|
where TInc : struct, IInc
|
|
|
|
|
{
|
|
|
|
|
internal static readonly int[] include = new TInc().GetComponentsIDs();
|
|
|
|
|
internal static readonly int[] exclude = Array.Empty<int>();
|
|
|
|
|
public static readonly int id = _typeIDIncrement++;
|
|
|
|
|
private static Mask<TInc> _instance = new Mask<TInc>();
|
2023-02-07 17:11:56 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
private Mask() { }
|
2023-02-07 17:11:56 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public static Mask<TInc> Instance
|
2023-02-07 17:11:56 +08:00
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
get => _instance;
|
2023-02-07 17:11:56 +08:00
|
|
|
|
}
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public override int ID
|
2023-02-07 17:11:56 +08:00
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
get => id;
|
2023-02-07 17:11:56 +08:00
|
|
|
|
}
|
2023-02-14 03:26:34 +08:00
|
|
|
|
internal override int[] Include
|
2023-02-07 17:11:56 +08:00
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
get => include;
|
2023-02-07 17:11:56 +08:00
|
|
|
|
}
|
2023-02-14 03:26:34 +08:00
|
|
|
|
internal override int[] Exclude
|
2023-02-07 17:11:56 +08:00
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
get => exclude;
|
2023-02-07 17:11:56 +08:00
|
|
|
|
}
|
2023-02-14 03:26:34 +08:00
|
|
|
|
}
|
|
|
|
|
public sealed class Mask<TInc, TExc> : Mask
|
|
|
|
|
where TInc : struct, IInc
|
|
|
|
|
where TExc : struct, IExc
|
|
|
|
|
{
|
|
|
|
|
internal static readonly int[] include = new TInc().GetComponentsIDs();
|
|
|
|
|
internal static readonly int[] exclude = new TExc().GetComponentsIDs();
|
|
|
|
|
public static readonly int id = _typeIDIncrement++;
|
|
|
|
|
private static Mask<TInc, TExc> _instance = new Mask<TInc, TExc>();
|
|
|
|
|
|
|
|
|
|
private Mask() { }
|
2023-02-07 17:11:56 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public static Mask<TInc, TExc> Instance
|
2023-02-07 17:11:56 +08:00
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
get => _instance;
|
2023-02-07 17:11:56 +08:00
|
|
|
|
}
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public override int ID
|
2023-02-07 17:11:56 +08:00
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
get => id;
|
2023-02-07 17:11:56 +08:00
|
|
|
|
}
|
2023-02-14 03:26:34 +08:00
|
|
|
|
internal override int[] Include
|
2023-02-07 17:11:56 +08:00
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
get => include;
|
|
|
|
|
}
|
|
|
|
|
internal override int[] Exclude
|
|
|
|
|
{
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
get => exclude;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2023-02-07 17:11:56 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
#region Filter
|
|
|
|
|
public interface IEcsFilter
|
|
|
|
|
{
|
|
|
|
|
public EcsWorld World { get; }
|
|
|
|
|
public Mask Mask { get; }
|
|
|
|
|
public IEcsReadonlyGroup Entities { get; }
|
|
|
|
|
public int EntitiesCount { get; }
|
|
|
|
|
}
|
2023-02-07 17:11:56 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
public class EcsFilter : IEcsFilter
|
|
|
|
|
{
|
|
|
|
|
private readonly EcsWorld _source;
|
|
|
|
|
private readonly EcsGroup _entities;
|
|
|
|
|
private readonly Mask _mask;
|
2023-02-07 17:11:56 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
#region Properties
|
|
|
|
|
public EcsWorld World
|
|
|
|
|
{
|
2023-02-07 17:11:56 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
2023-02-14 03:26:34 +08:00
|
|
|
|
get => _source;
|
|
|
|
|
}
|
|
|
|
|
public Mask Mask
|
|
|
|
|
{
|
2023-02-07 17:11:56 +08:00
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
2023-02-14 03:26:34 +08:00
|
|
|
|
get => _mask;
|
|
|
|
|
}
|
|
|
|
|
public IEcsReadonlyGroup Entities
|
|
|
|
|
{
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
get => _entities;
|
|
|
|
|
}
|
|
|
|
|
public int EntitiesCount
|
|
|
|
|
{
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
get => _entities.Count;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Constrcutors
|
|
|
|
|
internal EcsFilter(EcsWorld source, Mask mask, int capasity)
|
|
|
|
|
{
|
|
|
|
|
_source = source;
|
|
|
|
|
_mask = mask;
|
|
|
|
|
_entities = new EcsGroup(source, capasity);
|
2023-02-07 17:11:56 +08:00
|
|
|
|
}
|
2023-02-14 03:26:34 +08:00
|
|
|
|
#endregion
|
2023-02-07 17:11:56 +08:00
|
|
|
|
|
2023-02-14 03:26:34 +08:00
|
|
|
|
#region EntityChangedReact
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
internal void Add(int entityID)
|
2023-02-07 17:11:56 +08:00
|
|
|
|
{
|
2023-02-14 03:26:34 +08:00
|
|
|
|
_entities.Add(entityID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
|
|
internal void Remove(int entityID)
|
|
|
|
|
{
|
|
|
|
|
_entities.Remove(entityID);
|
2023-02-07 17:11:56 +08:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
2023-02-14 03:26:34 +08:00
|
|
|
|
#endregion
|
2023-02-07 17:11:56 +08:00
|
|
|
|
}
|