blob: e6fb60674743ee818c2d3b4adf23d6e85c3972e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
using System;
using System.Collections.Specialized;
namespace MonoGame.Extended.Entities
{
public class Aspect
{
internal Aspect()
{
AllSet = new BitVector32();
ExclusionSet = new BitVector32();
OneSet = new BitVector32();
}
public BitVector32 AllSet;
public BitVector32 ExclusionSet;
public BitVector32 OneSet;
public static AspectBuilder All(params Type[] types)
{
return new AspectBuilder().All(types);
}
public static AspectBuilder One(params Type[] types)
{
return new AspectBuilder().One(types);
}
public static AspectBuilder Exclude(params Type[] types)
{
return new AspectBuilder().Exclude(types);
}
public bool IsInterested(BitVector32 componentBits)
{
if (AllSet.Data != 0 && (componentBits.Data & AllSet.Data) != AllSet.Data)
return false;
if (ExclusionSet.Data != 0 && (componentBits.Data & ExclusionSet.Data) != 0)
return false;
if (OneSet.Data != 0 && (componentBits.Data & OneSet.Data) == 0)
return false;
return true;
}
}
}
|