From d06189486d1beb367189c7c379fb7fb3d81f3d86 Mon Sep 17 00:00:00 2001 From: "pan@work" Date: Thu, 8 Aug 2024 09:10:29 +0800 Subject: [PATCH] cc --- assets/script/game/common/SingletonModuleComp.ts | 2 +- assets/script/game/common/config/BoxSet.ts | 10 +++++----- assets/script/game/monster/MonsterViewComp.ts | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/assets/script/game/common/SingletonModuleComp.ts b/assets/script/game/common/SingletonModuleComp.ts index 90ff4aef..47960a93 100644 --- a/assets/script/game/common/SingletonModuleComp.ts +++ b/assets/script/game/common/SingletonModuleComp.ts @@ -62,7 +62,7 @@ export class SingletonModuleComp extends ecs.Comp { }; vmAdd() { - console.log("dataModelComp vmAdd"); + console.log("smc vm_data vmAdd"); VM.add(this.vm_data, "data"); } reset() { diff --git a/assets/script/game/common/config/BoxSet.ts b/assets/script/game/common/config/BoxSet.ts index 121940e2..dfc94e53 100644 --- a/assets/script/game/common/config/BoxSet.ts +++ b/assets/script/game/common/config/BoxSet.ts @@ -8,11 +8,11 @@ /** 碰撞分组 */ export enum BoxSet { //物理碰撞tag - DEFAULT = 0, - MONSTER = 90, - HERO = 10, - MONSTER_SKILL = 91, - HERO_SKILL = 11, + DEFAULT = 1, + MONSTER = 2, + HERO = 4, + MONSTER_SKILL = 8, + HERO_SKILL = 16, BOX_WIDTH = 64, BOX_HEIGHT = 64, diff --git a/assets/script/game/monster/MonsterViewComp.ts b/assets/script/game/monster/MonsterViewComp.ts index dd5fcaab..c5a720b3 100644 --- a/assets/script/game/monster/MonsterViewComp.ts +++ b/assets/script/game/monster/MonsterViewComp.ts @@ -52,9 +52,9 @@ export class MonsterViewComp extends CCComp { } } onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) { - switch (selfCollider.tag) { + switch (selfCollider.group) { case BoxSet.MONSTER: - switch (otherCollider.tag){ + switch (otherCollider.group){ case BoxSet.HERO: this.state = 2; console.log('onBeginContact',selfCollider,otherCollider); @@ -70,7 +70,7 @@ export class MonsterViewComp extends CCComp { } break; case BoxSet.HERO: - switch (otherCollider.tag){ + switch (otherCollider.group){ case BoxSet.MONSTER: this.state = 2; break; @@ -90,8 +90,8 @@ export class MonsterViewComp extends CCComp { // console.log('onPreSolve'); // } onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) { - if (otherCollider.tag === BoxSet.HERO && selfCollider.tag === BoxSet.MONSTER) { - // console.log('onPostSolve otherCollider.tag :'+otherCollider.tag); + if (otherCollider.group === BoxSet.HERO && selfCollider.group === BoxSet.MONSTER) { + // console.log('onPostSolve otherCollider.group :'+otherCollider.group); // this.speed = 0; // this.timer = 1; } @@ -114,9 +114,9 @@ export class MonsterViewComp extends CCComp { label.getComponent(Label)!.string = hero_name; let collider = this.getComponent(Collider2D); if(camp==1){ - collider.tag=BoxSet.HERO; + collider.group=BoxSet.HERO; }else{ - collider.tag=BoxSet.MONSTER; + collider.group=BoxSet.MONSTER; } }