This commit is contained in:
2024-08-23 13:26:26 +08:00
parent 75f0677b88
commit 97875dfe2b
10 changed files with 286 additions and 43 deletions

View File

@@ -37,7 +37,8 @@ export class SkillCom extends CCComp {
collider.tag = this.box_tag;
collider.sensor = true;
if (collider) {
collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
// collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
}
if(this.t_pos){
@@ -66,9 +67,9 @@ export class SkillCom extends CCComp {
}
}
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
if(otherCollider.group != selfCollider.group){
// console.log("skill end contact",selfCollider.group,otherCollider.group)
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
if(otherCollider.group != selfCollider.group&&otherCollider.tag !=BoxSet.ATK_RANGE&&otherCollider.tag !=BoxSet.SKILL_TAG){
// console.log("skill onBeginContact",selfCollider.group,otherCollider.group)
this.is_destroy=true
}
}