Changed: Version; System Registration behaviour
This commit is contained in:
parent
d86c07352a
commit
0571986059
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>nz.ac.massey.javaecs</groupId>
|
||||
<artifactId>javaecs</artifactId>
|
||||
<version>1.2-PRERELEASE-v2</version>
|
||||
<version>0.9.2-PRERELEASE</version>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
|
@ -13,10 +13,14 @@ package nz.ac.massey.javaecs;
|
||||
*/
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.BitSet;
|
||||
import java.util.HashSet;
|
||||
|
||||
public abstract class ECSSystem{
|
||||
Set<Entity> entities = new HashSet<>();
|
||||
protected Set<Entity> entities = new HashSet<>();
|
||||
protected BitSet registrationSet;
|
||||
|
||||
public BitSet getRegistrationSet;
|
||||
|
||||
/**
|
||||
* Implement additional parameterised init() functions as required.
|
||||
|
@ -15,7 +15,7 @@ import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
class SystemManager{
|
||||
private Map<Type, BitSet> registrationSignatures = new HashMap<>();
|
||||
//private Map<Type, BitSet> registrationSignatures = new HashMap<>();
|
||||
private Map<Type, ECSSystem> systems = new HashMap<>();
|
||||
|
||||
/**
|
||||
@ -40,8 +40,8 @@ class SystemManager{
|
||||
// Check if the signature is null
|
||||
if (!entityRegistrations.equals(null)){
|
||||
BitSet srcCpy = (BitSet)entityRegistrations.clone();
|
||||
srcCpy.and(registrationSignatures.get(key));
|
||||
if (srcCpy.equals(registrationSignatures.get(key))){ // Bitwise check if the entity is subscribed to this system
|
||||
srcCpy.and(systems.get(key).registrationSet);
|
||||
if (srcCpy.equals(systems.get(key).registrationSet)){ // Bitwise check if the entity is subscribed to this system
|
||||
systems.get(key).entities.add(entity);
|
||||
}
|
||||
else{
|
||||
@ -63,7 +63,6 @@ class SystemManager{
|
||||
return false;
|
||||
}
|
||||
systems.put(systemType, system);
|
||||
registrationSignatures.put(systemType, new BitSet());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -73,7 +72,7 @@ class SystemManager{
|
||||
* @param registrations the BitSet containing the required registrations set to true
|
||||
*/
|
||||
protected void setRegistrationSignature(Type systemType, BitSet registrations){
|
||||
registrationSignatures.put(systemType, registrations);
|
||||
systems.get(systemType).registrationSet = registrations;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user