新增被动系统与协调系统 完善matcher

This commit is contained in:
yhh
2020-07-01 14:54:35 +08:00
parent 549db2fcfe
commit 5e871bc501
10 changed files with 241 additions and 2 deletions

View File

@@ -7,6 +7,18 @@ class Matcher{
return new Matcher();
}
public getAllSet(){
return this.allSet;
}
public getExclusionSet(){
return this.exclusionSet;
}
public getOneSet(){
return this.oneSet;
}
public IsIntersted(e: Entity){
if (!this.allSet.isEmpty()){
for (let i = this.allSet.nextSetBit(0); i >= 0; i = this.allSet.nextSetBit(i + 1)){
@@ -23,4 +35,28 @@ class Matcher{
return true;
}
public all(...types: any[]): Matcher{
types.forEach(type => {
this.allSet.set(ComponentTypeManager.getIndexFor(type));
});
return this;
}
public exclude(...types: any[]){
types.forEach(type => {
this.exclusionSet.set(ComponentTypeManager.getIndexFor(type));
});
return this;
}
public one(...types: any[]){
types.forEach(type => {
this.oneSet.set(ComponentTypeManager.getIndexFor(type));
});
return this;
}
}