技能动画 继续完善
This commit is contained in:
20
assets/script/game/skills/EndBoxCom.ts
Normal file
20
assets/script/game/skills/EndBoxCom.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { _decorator, Collider2D, Component, Contact2DType, Node } from 'cc';
|
||||
import { SkillCom } from './SkillCom';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('EndBoxCom')
|
||||
export class EndBoxCom extends Component {
|
||||
base:SkillCom = null
|
||||
start() {
|
||||
this.base =this.node.getComponent(SkillCom)
|
||||
let collider = this.getComponent(Collider2D);
|
||||
if (collider) {
|
||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
}
|
||||
}
|
||||
onBeginContact (seCol: Collider2D, otCol: Collider2D) {
|
||||
if(otCol.group != seCol.group&&otCol.tag ==0)this.base.is_destroy=true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user