技能的销毁 还存在问题
This commit is contained in:
@@ -29,7 +29,6 @@ export class SkillCom extends CCComp {
|
||||
start() {
|
||||
this.node.active=true
|
||||
this.node.angle = this.angle;
|
||||
|
||||
let collider = this.getComponent(Collider2D);
|
||||
collider.group = this.box_group;
|
||||
// console.log("skill group",this.box_group)
|
||||
@@ -45,10 +44,16 @@ export class SkillCom extends CCComp {
|
||||
this.t_pos.y=Math.sin(this.angle * Math.PI / 180) * this.dis;
|
||||
tween(this.node).to( 1,{ angle:this.angle,position: this.t_pos},
|
||||
{
|
||||
onUpdate: (target: Vec3, ratio: number) => { // onUpdate 接受当前缓动的进度
|
||||
if(target.y <= 200 ){
|
||||
this.toDestroy()
|
||||
} // 将缓动系统计算出的结果赋予 node 的位置
|
||||
},
|
||||
onComplete: (target?: object) => {
|
||||
this.toDestroy()
|
||||
this.toDestroy()
|
||||
},
|
||||
} ).start();
|
||||
}
|
||||
).start();
|
||||
}else{
|
||||
tween(this.node).to( this.dis/this.speed,
|
||||
{ position: new Vec3(this.node.position.x+this.scale*this.dis,this.node.position.y) },
|
||||
@@ -63,7 +68,7 @@ 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)
|
||||
console.log("skill end contact",selfCollider.group,otherCollider.group)
|
||||
setTimeout(() => {
|
||||
this.toDestroy()
|
||||
}, 10);
|
||||
@@ -114,7 +119,7 @@ export class SkillCom extends CCComp {
|
||||
toDestroy() {
|
||||
if(!this.is_destroy){
|
||||
this.is_destroy = true;
|
||||
if(this.node.isValid) this.node.destroy()
|
||||
if(this.node.isValid) this.ent.destroy()
|
||||
}
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
|
||||
Reference in New Issue
Block a user