技能的销毁 还存在问题
This commit is contained in:
@@ -68,7 +68,7 @@ export const SkillSet={
|
||||
2007:{uuid: 2007,path: "1007",type: 1,level: 2,name: "复生-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
2008:{uuid: 2008,path: "1008",type: 1,level: 2,name: "灵巧-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
2009:{uuid: 2009,path: "1009",type: 1,level: 2,name: "盾守-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
2020:{uuid: 2010,path: "1010",type: 1,level: 2,name: "治愈-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
2010:{uuid: 2010,path: "1010",type: 1,level: 2,name: "治愈-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
2011:{uuid: 2011,path: "1011",type: 1,level: 4,name: "火焰风暴-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
2012:{uuid: 2012,path: "1012",type: 1,level: 4,name: "冰晶风暴-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
3001:{uuid: 3001,path: "1001",type: 1,level: 3,name: "火球术-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
@@ -80,7 +80,7 @@ export const SkillSet={
|
||||
3007:{uuid: 3007,path: "1007",type: 1,level: 3,name: "复生-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
3008:{uuid: 3008,path: "1008",type: 1,level: 3,name: "灵巧-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
3009:{uuid: 3009,path: "1009",type: 1,level: 3,name: "盾守-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
3030:{uuid: 3010,path: "1010",type: 1,level: 3,name: "治愈-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
3010:{uuid: 3010,path: "1010",type: 1,level: 3,name: "治愈-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
3011:{uuid: 3011,path: "1011",type: 1,level: 5,name: "火焰风暴-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
3012:{uuid: 3012,path: "1012",type: 1,level: 5,name: "冰晶风暴-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
4001:{uuid: 4001,path: "1001",type: 1,level: 4,name: "火球术-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
@@ -92,7 +92,7 @@ export const SkillSet={
|
||||
4007:{uuid: 4007,path: "1007",type: 1,level: 4,name: "复生-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
4008:{uuid: 4008,path: "1008",type: 1,level: 4,name: "灵巧-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
4009:{uuid: 4009,path: "1009",type: 1,level: 4,name: "盾守-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
4040:{uuid: 4010,path: "1010",type: 1,level: 4,name: "治愈-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
4010:{uuid: 4010,path: "1010",type: 1,level: 4,name: "治愈-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
4011:{uuid: 4011,path: "1011",type: 1,level: 6,name: "火焰风暴-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
4012:{uuid: 4012,path: "1012",type: 1,level: 6,name: "冰晶风暴-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
9001:{uuid: 9001,path: "9001",type: 1,level: 1,name: "基础攻击1",sp_name:"base",dis:90,count:1,atk: 4,sd:10,cd:1,speed:400,},
|
||||
|
||||
@@ -29,7 +29,7 @@ export class MapMonsterComp extends CCComp {
|
||||
cur_mission:number = 1; //当前关卡方案
|
||||
mission_list:any = []
|
||||
setp_timer: Timer = new Timer(0.5);
|
||||
setp_num:number = 5;
|
||||
setp_num:number = 50;
|
||||
onLoad(){
|
||||
// 监听全局事件
|
||||
oops.message.on("do_add_monster", this.on_do_add_monster, this);
|
||||
|
||||
@@ -82,14 +82,15 @@ export class CSkillComp extends CCComp {
|
||||
// console.log("CSkillComp toDestroy");
|
||||
if (this.node.isValid) {
|
||||
// console.log("CSkillComp.node.isValid");
|
||||
setTimeout(() => {
|
||||
// console.log("CSkillComp.node.destroy",this);
|
||||
this.ent.destroy()
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.sd.reset()
|
||||
this.cd.reset()
|
||||
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
@@ -110,6 +110,9 @@ export class MonsterViewComp extends CCComp {
|
||||
let skill = otherCollider.node.getComponent(SkillCom)!;
|
||||
// console.log('onPostSolve',skill);
|
||||
this.in_atked();
|
||||
if(this.hp <= 0 ){
|
||||
return
|
||||
}
|
||||
this.hp_change(skill.atk);
|
||||
}
|
||||
}
|
||||
@@ -219,7 +222,7 @@ export class MonsterViewComp extends CCComp {
|
||||
let dis = SkillSet[skill_uuid].dis;
|
||||
let atk = SkillSet[skill_uuid].atk+this.atk;
|
||||
let sp_name = SkillSet[skill_uuid].sp_name;
|
||||
skill.load(pos,speed,dis,scale,this.node,sp_name,atk);
|
||||
skill.load(pos,speed,dis,scale,this.node,sp_name,0);
|
||||
}
|
||||
in_act(dt: number) {
|
||||
|
||||
|
||||
@@ -92,12 +92,12 @@ export class RoleViewComp extends CCComp {
|
||||
this.atk_time += dt;
|
||||
}
|
||||
load_skill(skill_name:string){
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let pos = v3(30,30)
|
||||
let speed =400
|
||||
let scale = 1
|
||||
let range = 720
|
||||
skill.load(pos,speed,range,scale,this.node,skill_name,this.atk);
|
||||
// let skill = ecs.getEntity<Skill>(Skill);
|
||||
// let pos = v3(30,30)
|
||||
// let speed =400
|
||||
// let scale = 1
|
||||
// let range = 720
|
||||
// skill.load(pos,speed,range,scale,this.node,skill_name,this.atk);
|
||||
}
|
||||
in_atked() {
|
||||
var path = "game/skills/atked";
|
||||
|
||||
@@ -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