技能开始
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user