diff --git a/assets/resources/game/hero/top.prefab b/assets/resources/game/hero/top.prefab index ee7a6a4f..78efeda4 100644 --- a/assets/resources/game/hero/top.prefab +++ b/assets/resources/game/hero/top.prefab @@ -23,16 +23,19 @@ }, { "__id__": 16 + }, + { + "__id__": 32 } ], "_active": true, "_components": [ { - "__id__": 32 + "__id__": 48 } ], "_prefab": { - "__id__": 34 + "__id__": 50 }, "_lpos": { "__type__": "cc.Vec3", @@ -93,7 +96,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": 0, + "x": 5.223, "y": 4.463, "z": 0 }, @@ -106,7 +109,7 @@ }, "_lscale": { "__type__": "cc.Vec3", - "x": 1, + "x": 0.8, "y": 1, "z": 1 }, @@ -143,7 +146,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -30, + "x": -29, "y": 0, "z": 0 }, @@ -184,8 +187,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 60, - "height": 9 + "width": 58, + "height": 13 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -271,7 +274,7 @@ "_contentSize": { "__type__": "cc.Size", "width": 60, - "height": 10 + "height": 15 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -301,9 +304,9 @@ "_dstBlendFactor": 4, "_color": { "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, + "r": 0, + "g": 0, + "b": 0, "a": 255 }, "_spriteFrame": { @@ -321,7 +324,7 @@ "_fillStart": 0, "_fillRange": 0, "_isTrimmedMode": true, - "_useGrayscale": false, + "_useGrayscale": true, "_atlas": null, "_id": "" }, @@ -734,6 +737,394 @@ "targetOverrides": null, "nestedPrefabInstanceRoots": null }, + { + "__type__": "cc.Node", + "_name": "lv", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 33 + }, + { + "__id__": 39 + } + ], + "_active": true, + "_components": [ + { + "__id__": 45 + } + ], + "_prefab": { + "__id__": 47 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -21.65, + "y": 3.598, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "Slider_StageHorizontal_Icon_s_Blue", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 32 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 34 + }, + { + "__id__": 36 + } + ], + "_prefab": { + "__id__": 38 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 33 + }, + "_enabled": true, + "__prefab": { + "__id__": 35 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 25, + "height": 25 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "1aGQxruLlN7o1cvpkg+w6w" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 33 + }, + "_enabled": true, + "__prefab": { + "__id__": 37 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@45eb2", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "dcArv4aX5BT7Q8/ryNr7JJ" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "beKxBCL4tJa7jnDk+SHSXR", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "lv", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 32 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 40 + }, + { + "__id__": 42 + } + ], + "_prefab": { + "__id__": 44 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0.514, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 1, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 39 + }, + "_enabled": true, + "__prefab": { + "__id__": 41 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 13.123046875, + "height": 27.2 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "52OiVdq2FIS6n/At5AMidd" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 39 + }, + "_enabled": true, + "__prefab": { + "__id__": 43 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "5", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 20, + "_fontSize": 20, + "_fontFamily": "Arial", + "_lineHeight": 20, + "_overflow": 0, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": true, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 1, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "b1u114cQ9GVYzdhfy3Rypl" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "55ouENuiVCq5y534ATba9s", + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 32 + }, + "_enabled": true, + "__prefab": { + "__id__": 46 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "b6cy/O3+BPhoEbdec7aStO" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "02WqvhZKlNPKIWBWcAe/Nq", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, { "__type__": "cc.UITransform", "_name": "", @@ -744,7 +1135,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 33 + "__id__": 49 }, "_contentSize": { "__type__": "cc.Size", @@ -771,7 +1162,6 @@ "__id__": 0 }, "fileId": "5fqU0L3/FOhKaco5UkHuWT", - "instance": null, - "targetOverrides": null + "instance": null } ] \ No newline at end of file diff --git a/assets/script/game/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index d09506dc..0e0504c5 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -1,8 +1,9 @@ export const HeroSet = { 9001: { - uuid: 9001, path: "k1", type: 1, level: 1,cost:2, name: "白骑士", atk: 10, hp: 100, atk_dis: 100, atk_cd: 1, power: 0, power_max: 15, speed: 40, - skill_uuid: 9001, max_skill_uuid: 2002, atktype: 1, + uuid: 9001, path: "k1", type: 1, level: 1,cost:2, name: "白骑士", + atk: 10, hp: 100, atk_dis: 100, atk_cd: 1, power: 0, power_max: 15, speed: 40, + sk1: 9001, sk2: 2002, sk3: 9001, sk4: 2002, sk5: 9001, sk6: 2002, atktype: 1, }, diff --git a/assets/script/game/hero/Hero.ts b/assets/script/game/hero/Hero.ts index 7d9951d3..b0967a6b 100644 --- a/assets/script/game/hero/Hero.ts +++ b/assets/script/game/hero/Hero.ts @@ -73,15 +73,19 @@ export class Hero extends ecs.Entity { let talents=Talents; hv.scale = scale; hv.box_group = box_group; - hv.speed =hv.ospeed = hero_set.speed; hv.hero_uuid= uuid; hv.hero_name= hero_set.name; + + hv.speed =hv.ospeed = hero_set.speed; hv.atk_dis = hero_set.atk_dis; hv.power = hero_set.power; hv.level = hero_set.level; hv.type = hero_set.type; - hv.skill_uuid = hero_set.skill_uuid; - hv.max_skill_uuid = hero_set.max_skill_uuid; + hv.sk1 = hero_set.sk1; + hv.sk2 = hero_set.sk2; + hv.sk3 = hero_set.sk3; + hv.sk4 = hero_set.sk4; + hv.sk5 = hero_set.sk5; hv.role_heros_index = index; hv.type = hero_set.type; hv.hp= hv.hp_max =hero_set.hp; diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index b83b1679..7e6294ee 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -37,20 +37,28 @@ export class HeroViewComp extends CCComp { @property(Material) atkMaterial: Material; - // @property(Node) - // BoxRang:Node =null! - - is_role:boolean = false; enemy_pos:Vec3=null!; enemy:any=null!; - /** 角色动画 */ + as: HeroSpine = null!; + anm_timer:Timer = new Timer(2); + anm_name="idle" + status:String = "idle" + hero_uuid:number = 1001; hero_name : string = "hero"; level:number =1; scale: number = 1; /** 角色阵营 1:hero -1 :mon */ type: number = 1; /**角色类型 1:前排 2 后排 */ - state: number = 1; /** 状态 1:move ,2: act 3: stop */ + + box_group:number = BoxSet.HERO; + atk_range:number = 150; + private timer:Timer = new Timer(1); //计时器 + + + is_dead:boolean = false; //是否摧毁 + is_stop:boolean = false; + is_atking:boolean = false; hp: number = 100; /** 血量 */ hp_max: number = 100; /** 最大血量 */ @@ -60,20 +68,29 @@ export class HeroViewComp extends CCComp { power_max: number = 1200; /** 能量最大值 */ power_speed: number = 1; //能量回复速度每0.1秒回复量 - skill_uuid:number = 9001; - max_skill_uuid:number = 1001; + sk1:number = 9001; + sk2:number = 1001; + sk3:number = 1001; + sk4:number = 1001; + sk5:number = 1001; + atk: number = 10; /**攻击力 */ - buff_atk: number = 0; + atk_buff: number = 0; + atk_buffs:any = []; // atk_speed: number = 1; atk_cd: number = 1.3; /**攻击速度 攻击间隔 */ atk_dis: number = 80; atk_time: number = 0; /** 冷却时间 */ + st_boncus: number = 1; //技能持续时间加成 s_boncus: number = 1; //技能效果加成 + speed: number = 100; /** 角色移动速度 */ ospeed: number = 100; /** 角色初始速度 */ + Tpos: Vec3 = v3(0,-60,0); stop_cd: number = 0.5; /*停止倒计时*/ + //暴击 crit: number = 1.5; crit_rate: number = 0; @@ -84,22 +101,13 @@ export class HeroViewComp extends CCComp { shield_max:number = 200; shield_time:number = 0; //护盾持续时间 - box_group:number = BoxSet.HERO; - atk_range:number = 150; - private timer:Timer = new Timer(1); //计时器 - private m_timer:Timer = new Timer(0.1); - is_dead:boolean = false; //是否摧毁 - is_stop:boolean = false; - is_atking:boolean = false; + buff_shields:any=[]; - buff_atks:any = []; dir_y:number = 0; speek_time:number = 0; role_heros_index:number = -1; - anm_timer:Timer = new Timer(2); - anm_name="idle" - status:String = "idle" + onLoad() { this.as = this.getComponent(HeroSpine); // this.BoxRang = this.node.getChildByName("range_box"); @@ -109,16 +117,21 @@ export class HeroViewComp extends CCComp { start () { this.as.move() - this.node.getChildByName("top").getChildByName("hp").active = false; - this.sprite = this.node.getChildByName("anm").getComponent(Sprite); + /** 方向 */ this.node.setScale(this.scale,1); + this.node.getChildByName("top").setScale(this.scale,1); + /** 显示角色血量 */ + this.node.getChildByName("top").getChildByName("hp").active = true; + /** 闪光特效 */ + this.sprite = this.node.getChildByName("anm").getComponent(Sprite); + this.orginalFlashMaterial = this.sprite.getRenderMaterial(0); + // this.node.getChildByName("top").getChildByName("shield").active = false; // this.node.getChildByName("top").setScale(this.scale,1); // this.node.getChildByName("atk").setScale(this.scale,1); // this.node.getChildByName("atk").getComponent(Label).string = this.atk.toString(); // this.node.getChildByName("hp_max").setScale(this.scale,1); // this.node.getChildByName("hp_max").getComponent(Label).string=this.hp_max.toString(); - this.orginalFlashMaterial = this.sprite.getRenderMaterial(0); // this.BoxRang.getComponent(BoxRangComp).box_group = this.box_group; // this.BoxRang.getComponent(BoxRangComp).atk_range = this.atk_range // this.BoxRang.getComponent(BoxRangComp).offset_x = 300; @@ -126,6 +139,7 @@ export class HeroViewComp extends CCComp { // console.log("monseter ",this.BoxRang); // 注册单个碰撞体的回调函数 + let collider = this.getComponent(Collider2D); collider.group = this.box_group; console.log("hero collider ",this.scale,collider); @@ -135,7 +149,6 @@ export class HeroViewComp extends CCComp { collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this); // collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this); } - // this.node.getChildByName("level").getChildByName("level").getComponent(Label).string = this.level.toString(); } @@ -203,13 +216,13 @@ export class HeroViewComp extends CCComp { // this.change_anm() // } this.in_destroy(); - this.check_buff_atks(dt) + this.check_atk_buffs(dt) this.in_shield(dt); this.in_stop(dt); this.atk_time += dt; this.check_enemy_alive() this.in_atk(dt); - this.hp_show() + // this.hp_show() this.move(dt); @@ -315,9 +328,9 @@ export class HeroViewComp extends CCComp { this.power += power; if(this.power >= this.power_max){ this.as.atk() - // this.to_speek(smc.skills[this.max_skill_uuid].name) + // this.to_speek(smc.skills[this.sk2].name) this.scheduleOnce(()=>{ - this.handle_skill(this.max_skill_uuid); + this.handle_skill(this.sk2); },0.5) this.power = 0 } @@ -346,24 +359,24 @@ export class HeroViewComp extends CCComp { return {pos,t_pos} } - shoot_enemy(skill_uuid:number,y:number=0,x:number=0){ + shoot_enemy(sk1:number,y:number=0,x:number=0){ // console.log("mon shoot_enemy"); let skill = ecs.getEntity(Skill); let increase_atk=Math.floor(this.atk*smc.vm_data.mission.hero.atk) - let atk = smc.skills[skill_uuid].atk+this.buff_atk+increase_atk; + let atk = smc.skills[sk1].atk+this.atk_buff+increase_atk; let {pos,t_pos}=this.get_enemy_pos() pos.y=pos.y + y pos.x=pos.x + x - skill.load(pos,this.box_group,this.node,skill_uuid,atk,t_pos); - console.log(this.scale+this.hero_name+"使用技能:"+skill_uuid); - // this.tooltip(3,smc.skills[skill_uuid].name,this.skill_uuid); + skill.load(pos,this.box_group,this.node,sk1,atk,t_pos); + console.log(this.scale+this.hero_name+"使用技能:"+sk1); + // this.tooltip(3,smc.skills[sk1].name,this.sk1); } to_add_buff(hero:any,s_uuid:number){ let skill = ecs.getEntity(Skill); let atk = smc.skills[s_uuid].atk+this.atk; let {pos,t_pos}=this.get_hero_pos(hero) - skill.load(pos,this.box_group,this.node,this.max_skill_uuid,atk,t_pos); + skill.load(pos,this.box_group,this.node,this.sk2,atk,t_pos); if(smc.skills[s_uuid].hp > 0){ //buff加血 let increase_hp=Math.floor(smc.skills[s_uuid].hp*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk) hero.add_hp(increase_hp) @@ -464,7 +477,7 @@ export class HeroViewComp extends CCComp { console.log("atk_cd:"+this.atk_cd); this.as.atk(); this.scheduleOnce(()=>{ - this.handle_skill(this.skill_uuid) + this.handle_skill(this.sk1) },0.4) } } @@ -524,29 +537,29 @@ export class HeroViewComp extends CCComp { } add_atk(atk: number,time:number=0){ if(time > 0){ - this.buff_atk=0 + this.atk_buff=0 let buff={atk:atk,time:time} - this.buff_atks.push(buff); - this.buff_atks.forEach((element: { atk: number; }) => { - this.buff_atk += element.atk + this.atk_buffs.push(buff); + this.atk_buffs.forEach((element: { atk: number; }) => { + this.atk_buff += element.atk }); }else{ this.atk += atk; } - // console.log(this.buff_atks) + // console.log(this.atk_buffs) } - check_buff_atks(dt: number){ - for(let i=0;i