update readme

This commit is contained in:
honmono
2022-03-30 10:57:19 +08:00
parent c7d30bc03b
commit 1785cbedea
16 changed files with 1073 additions and 45 deletions

View File

@@ -23,7 +23,13 @@ export class SysAttack extends ECSSystem {
}
/** */
public onEntityLeave(world: ECSWorld, entity: number): void {
let filter = world.getFilter(FILTER_ATTACKABLE);
// 判断当前monitor是否
filter.entities.forEach((value: boolean, otherEntity: number) => {
let comBeAttacked = world.getComponent(otherEntity, ComBeAttacked);
if(!comBeAttacked) return ;
if(comBeAttacked.attacker == entity) comBeAttacked.attacker = -1;
});
}
/** 更新 */
public onUpdate(world: ECSWorld, dt: number): void {

View File

@@ -19,9 +19,18 @@ const FILTER_NODE_EVENT = GenFillterKey([ComCocosNode, ComTransform]);
export class SysCocosView extends ECSSystem implements ITouchProcessor {
onTouchStart(worldPos: cc.Vec2, world: ECSWorld): boolean {
return false;
}
onTouchMove(worldPos: cc.Vec2, world: ECSWorld): void {
}
onTouchCancel(worldPos: cc.Vec2, world: ECSWorld): void {
}
onAdd(world: ECSWorld) {
}

View File

@@ -21,8 +21,8 @@ export class SysMonitor extends ECSSystem {
/** */
public onEntityLeave(world: ECSWorld, entity: number): void {
let filter = world.getFilter(FILTER_MONITOR);
// 判断当前monitor是否
filter.entities.forEach((value: boolean, otherEntity: number) => {
// 判断当前monitor是否
filter.entities.forEach((value: boolean, otherEntity: number) => {
let comMonitor = world.getComponent(otherEntity, ComMonitor);
if(!comMonitor) return ;
for(let i=comMonitor.others.length-1; i>=0; i--) {
@@ -60,12 +60,6 @@ export class SysMonitor extends ECSSystem {
let _check = (com: ComTransform) => {
return (a.sub(cc.v2(com.x, com.y)).len() < comMonitor.aroundLen || isInTriangle(cc.v2(com.x, com.y), a, b, c) || isInTriangle(cc.v2(com.x, com.y), b, c, d))
}
// for(let i=comMonitor.others.length-1; i>=0; i--) {
// const com = world.getComponent(comMonitor.others[i], ComTransform);
// if(!com || !_check(com)) {
// comMonitor.others.splice(i, 1);
// }
// }
if(comMonitor.others.indexOf(otherEntity) == -1 && _check(comTransOther)) {
comMonitor.others.push(otherEntity);