read write lookups use hashset
parent
64f6e13216
commit
d5a196b298
|
@ -8,8 +8,8 @@ namespace Encompass
|
||||||
{
|
{
|
||||||
public abstract class Engine
|
public abstract class Engine
|
||||||
{
|
{
|
||||||
internal readonly List<Type> writeTypes = new List<Type>();
|
internal readonly HashSet<Type> writeTypes = new HashSet<Type>();
|
||||||
internal readonly List<Type> readTypes = new List<Type>();
|
internal readonly HashSet<Type> readTypes = new HashSet<Type>();
|
||||||
|
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
private ComponentManager componentManager;
|
private ComponentManager componentManager;
|
||||||
|
@ -17,10 +17,10 @@ namespace Encompass
|
||||||
|
|
||||||
protected Engine()
|
protected Engine()
|
||||||
{
|
{
|
||||||
var emitsAttribute = GetType().GetCustomAttribute<Writes>(false);
|
var writesAttribute = GetType().GetCustomAttribute<Writes>(false);
|
||||||
if (emitsAttribute != null)
|
if (writesAttribute != null)
|
||||||
{
|
{
|
||||||
writeTypes = emitsAttribute.writeTypes;
|
writeTypes = writesAttribute.writeTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
var readsAttribute = GetType().GetCustomAttribute<Reads>(false);
|
var readsAttribute = GetType().GetCustomAttribute<Reads>(false);
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Encompass
|
||||||
[System.AttributeUsage(System.AttributeTargets.Class)]
|
[System.AttributeUsage(System.AttributeTargets.Class)]
|
||||||
public class Reads : System.Attribute
|
public class Reads : System.Attribute
|
||||||
{
|
{
|
||||||
public readonly List<Type> readTypes;
|
public readonly HashSet<Type> readTypes;
|
||||||
|
|
||||||
public Reads(params Type[] readTypes)
|
public Reads(params Type[] readTypes)
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ namespace Encompass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.readTypes = new List<Type>(readTypes);
|
this.readTypes = new HashSet<Type>(readTypes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Encompass
|
||||||
[AttributeUsage(AttributeTargets.Class)]
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
public class Writes : Attribute
|
public class Writes : Attribute
|
||||||
{
|
{
|
||||||
public readonly List<Type> writeTypes;
|
public readonly HashSet<Type> writeTypes;
|
||||||
|
|
||||||
public Writes(params Type[] writeTypes)
|
public Writes(params Type[] writeTypes)
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@ namespace Encompass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.writeTypes = new List<Type>(writeTypes);
|
this.writeTypes = new HashSet<Type>(writeTypes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue