技能开始

This commit is contained in:
panw
2025-01-03 16:43:03 +08:00
parent df8738bd84
commit 0524eee5e0
21 changed files with 1347 additions and 233 deletions

View File

@@ -26,22 +26,26 @@ export class baseCom extends Component {
in_time:number = 0.3; // 不动技能持续时间
start() {
console.log("baseCom start")
// let collider = this.getComponent(Collider2D);
// collider.group = this.box_group;
// collider.tag = this.box_tag;
// collider.sensor = true;
// if (collider) {
// collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
// // collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
// }
let collider = this.getComponent(Collider2D);
collider.group = this.box_group;
collider.tag = this.box_tag;
collider.sensor = true;
if (collider) {
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
// collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
}
}
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D) {
}
onPostSolve(selfCollider: Collider2D, otherCollider: Collider2D){
if(otherCollider.group != selfCollider.group&&otherCollider.tag ==0){
this.atk_count+=1
// console.log("skill onBeginContact",selfCollider.group,otherCollider.group)
if(this.type==1 ){
this.is_destroy=true
}
}
}
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
}
reset() {