修复bitset调整数组大小时错误/componentTypeManager获取修复
This commit is contained in:
@@ -20,18 +20,25 @@ module es {
|
||||
return this.oneSet;
|
||||
}
|
||||
|
||||
public IsIntersted(e: Entity) {
|
||||
public isInterestedEntity(e: Entity) {
|
||||
return this.isInterested(e.componentBits);
|
||||
}
|
||||
|
||||
public isInterested(componentBits: BitSet) {
|
||||
// 检查实体是否拥有该方面中定义的所有组件
|
||||
if (!this.allSet.isEmpty()) {
|
||||
for (let i = this.allSet.nextSetBit(0); i >= 0; i = this.allSet.nextSetBit(i + 1)) {
|
||||
if (!e.componentBits.get(i))
|
||||
if (!componentBits.get(i))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.exclusionSet.isEmpty() && this.exclusionSet.intersects(e.componentBits))
|
||||
// 如果我们仍然感兴趣,检查该实体是否拥有任何一个排除组件,如果有,那么系统就不感兴趣
|
||||
if (!this.exclusionSet.isEmpty() && this.exclusionSet.intersects(componentBits))
|
||||
return false;
|
||||
|
||||
if (!this.oneSet.isEmpty() && !this.oneSet.intersects(e.componentBits))
|
||||
// 如果我们仍然感兴趣,检查该实体是否拥有oneSet中的任何一个组件。如果是,系统就会感兴趣
|
||||
if (!this.oneSet.isEmpty() && !this.oneSet.intersects(componentBits))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user