From e90714158099858792a444258326ee26e0c6d471 Mon Sep 17 00:00:00 2001 From: "pan@work" Date: Fri, 15 Nov 2024 10:17:06 +0800 Subject: [PATCH] =?UTF-8?q?hero=20=E6=AD=BB=E4=BA=A1=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E5=A2=93=E5=9C=B0=20=E8=80=8C=E4=B8=8D=E6=98=AF=E6=91=A7?= =?UTF-8?q?=E6=AF=81=EF=BC=8Ctodo=20=E5=8F=97=E4=BC=A4=E5=8A=A8=E7=94=BB?= =?UTF-8?q?=E9=87=8D=E5=81=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/resources/game/skills/atked.prefab | 16 ++-- assets/script/game/common/config/SkillSet.ts | 2 +- assets/script/game/hero/Hero.ts | 40 +++++----- assets/script/game/hero/HeroSpine.ts | 16 ++-- assets/script/game/hero/HeroViewComp.ts | 83 ++++++++------------ assets/script/game/map/MapMonsterComp.ts | 6 +- 6 files changed, 75 insertions(+), 88 deletions(-) diff --git a/assets/resources/game/skills/atked.prefab b/assets/resources/game/skills/atked.prefab index f2ccae50..919fb1d8 100644 --- a/assets/resources/game/skills/atked.prefab +++ b/assets/resources/game/skills/atked.prefab @@ -43,13 +43,13 @@ "__type__": "cc.Quat", "x": 0, "y": 0, - "z": -0.49999999999999994, - "w": 0.8660254037844387 + "z": 0, + "w": 1 }, "_lscale": { "__type__": "cc.Vec3", - "x": 0.2, - "y": 1, + "x": 1, + "y": 0.8, "z": 1 }, "_mobility": 0, @@ -58,7 +58,7 @@ "__type__": "cc.Vec3", "x": 0, "y": 0, - "z": -60 + "z": 0 }, "_id": "" }, @@ -107,9 +107,9 @@ "_dstBlendFactor": 4, "_color": { "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, + "r": 250, + "g": 234, + "b": 0, "a": 255 }, "_skeletonData": { diff --git a/assets/script/game/common/config/SkillSet.ts b/assets/script/game/common/config/SkillSet.ts index 7b321790..785e345b 100644 --- a/assets/script/game/common/config/SkillSet.ts +++ b/assets/script/game/common/config/SkillSet.ts @@ -54,7 +54,7 @@ export const SkillSet={ dis:1,count:5,in:0,run:0,atk:10,hp:0,shield:0,sd:10,cd:2,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600, }, 9001:{uuid: 9001,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "普攻",sp_name:"patk",info:"释放一个魔法球攻击敌人", - dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,}, + dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:6000,}, 9002:{uuid: 9002,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "魔法小球",sp_name:"mball",info:"释放一个魔法球攻击敌人", dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:0,sd:0,cd:0,bsd:0,bcd:0,sk_uuid:1001,sk_count:0,speed:600,}, 9003:{uuid: 9003,path: "1001",type: 1,tg:3,angle:true,level: 1,name: "射击",sp_name:"arrow",info:"释放一个魔法球攻击敌人", diff --git a/assets/script/game/hero/Hero.ts b/assets/script/game/hero/Hero.ts index 79335c39..47a1892f 100644 --- a/assets/script/game/hero/Hero.ts +++ b/assets/script/game/hero/Hero.ts @@ -58,7 +58,7 @@ export class Hero extends ecs.Entity { var path = "game/hero/"+smc.heros[uuid].path; var prefab: Prefab = oops.res.get(path, Prefab)!; var node = instantiate(prefab); - + var scene = smc.map.MapView.scene; node.parent = scene.entityLayer!.node! @@ -70,29 +70,29 @@ export class Hero extends ecs.Entity { hero_init(uuid:number=1001,node:Node,index:number=-1,scale:number=1,box_group=BoxSet.HERO){ var hv = node.getComponent(HeroViewComp)!; // console.log("hero_init",buff) - let hero_set= smc.heros[uuid] - let role_talent= smc.vm_data.talent + let HInf= smc.heros[uuid] // 角色数据 + let talent= smc.vm_data.talent let talents=Talents; hv.scale = scale; hv.box_group = box_group; hv.hero_uuid= uuid; - hv.hero_name= hero_set.name; - - hv.speed =hv.ospeed = hero_set.speed; - hv.dis = hero_set.dis; - hv.power = hero_set.power; - hv.level = hero_set.level; - hv.type = hero_set.type; - 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.type = hero_set.type; - hv.hp= hv.hp_max =hero_set.hp; - hv.ap = hero_set.ap; - hv.cd = hero_set.a_cd - hv.power_max= hero_set.power_max + hv.hero_name= HInf.name; + hv.hero_type= HInf.type; + hv.speed =hv.ospeed = HInf.speed; + hv.dis = HInf.dis; + hv.power = HInf.power; + hv.level = HInf.level; + hv.type = HInf.type; + hv.sk1 = HInf.sk1; + hv.sk2 = HInf.sk2; + hv.sk3 = HInf.sk3; + hv.sk4 = HInf.sk4; + hv.sk5 = HInf.sk5; + hv.type = HInf.type; + hv.hp= hv.hp_max =HInf.hp; + hv.ap = HInf.ap; + hv.cd = HInf.a_cd + hv.power_max= HInf.power_max this.add(hv); } set_ratio(uuid:number){ diff --git a/assets/script/game/hero/HeroSpine.ts b/assets/script/game/hero/HeroSpine.ts index dbc6defd..36042c45 100644 --- a/assets/script/game/hero/HeroSpine.ts +++ b/assets/script/game/hero/HeroSpine.ts @@ -53,44 +53,44 @@ export class HeroSpine extends Component { } onAnimationEvent(type: Animation.EventType, state: AnimationState){ if(type==Animation.EventType.FINISHED){ - console.log("animator end",state.name); + // console.log("animator end",state.name); if(state.name==this.atk_clip.name||state.name==this.max_clip.name){ - console.log("animator no atk and no max"); + // console.log("animator no atk and no max"); this.default(); } } } change_default(value:string){ - console.log("change default",value); + // console.log("change default",value); this.default_clip=value; } default() { if(!this.in_playing()){ - console.log("do default"); + // console.log("do default"); this.animator.play(this.default_clip); } } idle(){ if(!this.in_playing()){ - console.log("do idle"); + // console.log("do idle"); this.animator.play(this.idle_clip.name); } } atk() { - console.log("do atk"); + // console.log("do atk"); this.animator.play(this.atk_clip.name); } max(){ - console.log("do max"); + // console.log("do max"); this.animator.play(this.max_clip.name); } move(){ if(!this.in_playing()){ - console.log("do move"); + // console.log("do move"); this.animator.play(this.move_clip.name); } } diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 8c745ef4..0da51880 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -19,11 +19,9 @@ import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/ import { SkillCom } from "../skills/SkillCom"; import { SkillSet } from "../common/config/SkillSet"; import { Tooltip } from "../skills/Tooltip"; -import { MoveToComp } from "../common/ecs/position/MoveTo"; -import { BoxRangComp } from "./BoxRangComp"; -import { MonViewComp } from "../mon/MonViewComp"; import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager"; import { TimerManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/TimerManager"; +import { HeroSet } from "../common/config/heroSet"; const { ccclass, property } = _decorator; /** 角色显示组件 */ @@ -47,6 +45,7 @@ export class HeroViewComp extends CCComp { hero_uuid:number = 1001; hero_name : string = "hero"; + hero_type:number = 1; level:number =1; scale: number = 1; /** 角色阵营 1:hero -1 :mon */ type: number = 1; /**角色类型 1:前排 2 后排 */ @@ -203,18 +202,15 @@ export class HeroViewComp extends CCComp { } onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) { } - status_change(type:string){ - if(this.status == type) return - this.status=type - if(type != "move"){ - this.as.change_default("idle") - }else{ - this.as.change_default("move") - } - } - update(dt: number){ - if(!smc.vm_data.mission.play||smc.vm_data.pause||this.is_dead){ + if(!smc.vm_data.mission.play||smc.vm_data.pause){ + let pos =v3(this.scale*-9999,this.node.position.y,this.node.position.z) + this.node.setPosition(pos) + return + } + if(this.is_dead){ + let pos =v3(this.scale*-9999,this.node.position.y,this.node.position.z) + this.node.setPosition(pos) return } if (this.timer.update(dt)) { @@ -231,13 +227,18 @@ export class HeroViewComp extends CCComp { // this.hp_show() this.move(dt); - - // this.in_speek(dt); - // this.move_to() - // if(this.m_timer.update(dt)){ - // this.move_to() - // } } + status_change(type:string){ + if(this.status == type) return + this.status=type + if(type != "move"){ + this.as.change_default("idle") + }else{ + this.as.change_default("move") + } + } + + change_anm(){ if (this.anm_name == "max"){ this.as.max() @@ -318,18 +319,7 @@ export class HeroViewComp extends CCComp { this.node.getChildByName("top").getChildByName("hp").active = true; } } - move_to(target:any){ - // if(this.stop_cd > 0){ - // return - // } - // if(this.enemy){ - // return - // } - var move = this.ent.get(MoveToComp) || this.ent.add(MoveToComp); - move.target = v3(target.x,target.y); - move.node = this.node; - move.speed = this.ospeed; - } + power_change(power: number){ this.power += power; if(this.power >= this.power_max){ @@ -534,8 +524,7 @@ export class HeroViewComp extends CCComp { this.is_dead = true; // setTimeout(() => { // this.ent.destroy(); - // }, 15); - this.toDestroy() + // }, 15); } } add_atk(atk: number,time:number=0){ @@ -606,31 +595,27 @@ export class HeroViewComp extends CCComp { } in_atked() { - var path = "game/skills/atked"; - var prefab: Prefab = oops.res.get(path, Prefab)!; - var node = instantiate(prefab); - let pos = v3(0,60) - node.setPosition(pos) - node.parent = this.node; - // this.sprite.setSharedMaterial(this.hitFlashMaterial, 0); - // this.scheduleOnce(() => { - // this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0); - // }, 0.1); - - + var path = "game/skills/atked"; + var prefab: Prefab = oops.res.get(path, Prefab)!; + var node = instantiate(prefab); + let pos =v3(0,30); + node.setPosition(pos) + node.parent = this.node; } dead(){ var path = "game/skills/dead"; var prefab: Prefab = oops.res.get(path, Prefab)!; var node = instantiate(prefab); - node.setPosition(this.node.position.x,this.node.position.y+30,this.node.position.z); + let pos = v3(this.node.position.x,this.node.position.y+30,this.node.position.z); node.parent = this.node.parent; + node.setPosition(pos); } toDestroy(){ - this.node.setPosition(this.scale*9999,this.node.position.y) + } toAlive(){ - this.node.setPosition(-1*this.scale*BoxSet.HERO_START,this.node.position.y) + let pos =v3(HeroSet.StartPos[this.hero_type],this.node.position.y,this.node.position.z) + this.node.setPosition(pos) } reset() { this.is_dead = false; diff --git a/assets/script/game/map/MapMonsterComp.ts b/assets/script/game/map/MapMonsterComp.ts index dedac74f..afc41b1f 100644 --- a/assets/script/game/map/MapMonsterComp.ts +++ b/assets/script/game/map/MapMonsterComp.ts @@ -217,7 +217,8 @@ export class MapMonsterComp extends CCComp { private addHero(uuid:number=1001) { let hero = ecs.getEntity(Hero); let scale = 1 - let pos:Vec3 = v3(HeroSet[smc.heros[uuid].type],BoxSet.GAME_LINE); + let pos:Vec3 = v3(HeroSet.StartPos[smc.heros[uuid].type],BoxSet.GAME_LINE); + console.log("addHero:",pos) hero.load(pos,scale,uuid); this.set_start_point() } @@ -225,7 +226,8 @@ export class MapMonsterComp extends CCComp { let monster = ecs.getEntity(Hero); let scale = -1 let index = -1 - let pos:Vec3 = v3(-1*HeroSet[smc.heros[uuid].type],BoxSet.GAME_LINE); + let pos:Vec3 = v3(-1*HeroSet.StartPos[smc.heros[uuid].type],BoxSet.GAME_LINE); + console.log("addMonster:",pos) monster.load(pos,scale,uuid,index,false); }