mirror of
https://github.com/kirikayakazuto/CocosCreator_ECS
synced 2025-12-18 09:59:54 +00:00
update readme
This commit is contained in:
@@ -7,8 +7,6 @@ export class ComMovable {
|
||||
public speed = 0;
|
||||
public points: cc.Vec2[] = [];
|
||||
public pointIdx = 0;
|
||||
|
||||
public keepDir = false;
|
||||
|
||||
public speedDirty = false;
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user