技能的销毁 还存在问题

This commit is contained in:
2024-08-22 17:20:13 +08:00
parent 1be37ab104
commit 6e9faca1a3
9 changed files with 177 additions and 44 deletions

View File

@@ -28,17 +28,17 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 70 "__id__": 80
}, },
{ {
"__id__": 72 "__id__": 82
}, },
{ {
"__id__": 74 "__id__": 84
} }
], ],
"_prefab": { "_prefab": {
"__id__": 76 "__id__": 86
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -197,17 +197,17 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 63 "__id__": 73
}, },
{ {
"__id__": 65 "__id__": 75
}, },
{ {
"__id__": 67 "__id__": 77
} }
], ],
"_prefab": { "_prefab": {
"__id__": 69 "__id__": 79
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -263,11 +263,11 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 60 "__id__": 70
} }
], ],
"_prefab": { "_prefab": {
"__id__": 62 "__id__": 72
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1023,14 +1023,14 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 55 "__id__": 65
}, },
{ {
"__id__": 57 "__id__": 67
} }
], ],
"_prefab": { "_prefab": {
"__id__": 59 "__id__": 69
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1113,6 +1113,30 @@
}, },
{ {
"__id__": 54 "__id__": 54
},
{
"__id__": 55
},
{
"__id__": 57
},
{
"__id__": 59
},
{
"__id__": 60
},
{
"__id__": 61
},
{
"__id__": 62
},
{
"__id__": 63
},
{
"__id__": 64
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -1143,8 +1167,8 @@
], ],
"value": { "value": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -312.4457, "x": -13.446,
"y": 27.56899999999996, "y": -13.431,
"z": 0 "z": 0
} }
}, },
@@ -1187,7 +1211,7 @@
"propertyPath": [ "propertyPath": [
"_active" "_active"
], ],
"value": false "value": true
}, },
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
@@ -1204,6 +1228,106 @@
"z": 1 "z": 1
} }
}, },
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 56
},
"propertyPath": [
"_group"
],
"value": 4
},
{
"__type__": "cc.TargetInfo",
"localID": [
"c8EJ1KQ3hNRbAw0cgsaNRx"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 58
},
"propertyPath": [
"_group"
],
"value": 4
},
{
"__type__": "cc.TargetInfo",
"localID": [
"62fAGknj9OypOrug6f/FI6"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 58
},
"propertyPath": [
"_sensor"
],
"value": true
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 56
},
"propertyPath": [
"_type"
],
"value": 2
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 58
},
"propertyPath": [
"_density"
],
"value": 0
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 58
},
"propertyPath": [
"_offset"
],
"value": {
"__type__": "cc.Vec2",
"x": 1.1,
"y": 35.9
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 58
},
"propertyPath": [
"_size"
],
"value": {
"__type__": "cc.Size",
"width": 57.5,
"height": 128
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 56
},
"propertyPath": [
"_gravityScale"
],
"value": 0
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -1214,7 +1338,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 56 "__id__": 66
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -1242,7 +1366,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 58 "__id__": 68
}, },
"light": { "light": {
"__uuid__": "319c7eb8-9826-48b6-81e4-82559dbf82a8", "__uuid__": "319c7eb8-9826-48b6-81e4-82559dbf82a8",
@@ -1277,7 +1401,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 61 "__id__": 71
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -1318,7 +1442,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 64 "__id__": 74
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -1346,7 +1470,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 66 "__id__": 76
}, },
"camera": { "camera": {
"__id__": 3 "__id__": 3
@@ -1364,7 +1488,7 @@
"__id__": 41 "__id__": 41
}, },
"SkillLayer": { "SkillLayer": {
"__id__": 57 "__id__": 67
}, },
"isFollowPlayer": true, "isFollowPlayer": true,
"_id": "" "_id": ""
@@ -1383,7 +1507,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 68 "__id__": 78
}, },
"_id": "" "_id": ""
}, },
@@ -1414,7 +1538,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 71 "__id__": 81
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -1442,7 +1566,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 73 "__id__": 83
}, },
"_cameraComponent": { "_cameraComponent": {
"__id__": 3 "__id__": 3
@@ -1464,7 +1588,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 75 "__id__": 85
}, },
"_alignFlags": 45, "_alignFlags": 45,
"_target": null, "_target": null,

View File

@@ -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,}, 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,}, 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,}, 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,}, 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,}, 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,}, 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,}, 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,}, 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,}, 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,}, 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,}, 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,}, 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,}, 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,}, 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,}, 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,}, 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,}, 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,}, 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,},

View File

@@ -29,7 +29,7 @@ export class MapMonsterComp extends CCComp {
cur_mission:number = 1; //当前关卡方案 cur_mission:number = 1; //当前关卡方案
mission_list:any = [] mission_list:any = []
setp_timer: Timer = new Timer(0.5); setp_timer: Timer = new Timer(0.5);
setp_num:number = 5; setp_num:number = 50;
onLoad(){ onLoad(){
// 监听全局事件 // 监听全局事件
oops.message.on("do_add_monster", this.on_do_add_monster, this); oops.message.on("do_add_monster", this.on_do_add_monster, this);

View File

@@ -82,14 +82,15 @@ export class CSkillComp extends CCComp {
// console.log("CSkillComp toDestroy"); // console.log("CSkillComp toDestroy");
if (this.node.isValid) { if (this.node.isValid) {
// console.log("CSkillComp.node.isValid"); // console.log("CSkillComp.node.isValid");
setTimeout(() => {
// console.log("CSkillComp.node.destroy",this); // console.log("CSkillComp.node.destroy",this);
this.ent.destroy() this.ent.destroy()
}, 10);
} }
} }
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */ /** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() { reset() {
this.sd.reset()
this.cd.reset()
this.node.destroy(); this.node.destroy();
} }
} }

View File

@@ -110,6 +110,9 @@ export class MonsterViewComp extends CCComp {
let skill = otherCollider.node.getComponent(SkillCom)!; let skill = otherCollider.node.getComponent(SkillCom)!;
// console.log('onPostSolve',skill); // console.log('onPostSolve',skill);
this.in_atked(); this.in_atked();
if(this.hp <= 0 ){
return
}
this.hp_change(skill.atk); this.hp_change(skill.atk);
} }
} }
@@ -219,7 +222,7 @@ export class MonsterViewComp extends CCComp {
let dis = SkillSet[skill_uuid].dis; let dis = SkillSet[skill_uuid].dis;
let atk = SkillSet[skill_uuid].atk+this.atk; let atk = SkillSet[skill_uuid].atk+this.atk;
let sp_name = SkillSet[skill_uuid].sp_name; 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) { in_act(dt: number) {

View File

@@ -92,12 +92,12 @@ export class RoleViewComp extends CCComp {
this.atk_time += dt; this.atk_time += dt;
} }
load_skill(skill_name:string){ load_skill(skill_name:string){
let skill = ecs.getEntity<Skill>(Skill); // let skill = ecs.getEntity<Skill>(Skill);
let pos = v3(30,30) // let pos = v3(30,30)
let speed =400 // let speed =400
let scale = 1 // let scale = 1
let range = 720 // let range = 720
skill.load(pos,speed,range,scale,this.node,skill_name,this.atk); // skill.load(pos,speed,range,scale,this.node,skill_name,this.atk);
} }
in_atked() { in_atked() {
var path = "game/skills/atked"; var path = "game/skills/atked";

View File

@@ -29,7 +29,6 @@ export class SkillCom extends CCComp {
start() { start() {
this.node.active=true this.node.active=true
this.node.angle = this.angle; this.node.angle = this.angle;
let collider = this.getComponent(Collider2D); let collider = this.getComponent(Collider2D);
collider.group = this.box_group; collider.group = this.box_group;
// console.log("skill 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; 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}, 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) => { onComplete: (target?: object) => {
this.toDestroy() this.toDestroy()
}, },
} ).start(); }
).start();
}else{ }else{
tween(this.node).to( this.dis/this.speed, tween(this.node).to( this.dis/this.speed,
{ position: new Vec3(this.node.position.x+this.scale*this.dis,this.node.position.y) }, { 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) { onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
if(otherCollider.group != selfCollider.group){ if(otherCollider.group != selfCollider.group){
// console.log("skill end contact",selfCollider.group,otherCollider.group) console.log("skill end contact",selfCollider.group,otherCollider.group)
setTimeout(() => { setTimeout(() => {
this.toDestroy() this.toDestroy()
}, 10); }, 10);
@@ -114,7 +119,7 @@ export class SkillCom extends CCComp {
toDestroy() { toDestroy() {
if(!this.is_destroy){ if(!this.is_destroy){
this.is_destroy = true; this.is_destroy = true;
if(this.node.isValid) this.node.destroy() if(this.node.isValid) this.ent.destroy()
} }
} }
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */ /** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */

BIN
excel/heros.xlsx Normal file

Binary file not shown.

BIN
excel/skills.xlsx Normal file

Binary file not shown.