diff --git a/assets/script/game/common/config/MissionSet.ts b/assets/script/game/common/config/MissionSet.ts index faedee68..2bc06c2d 100644 --- a/assets/script/game/common/config/MissionSet.ts +++ b/assets/script/game/common/config/MissionSet.ts @@ -1,7 +1,7 @@ export const MissionNum = [1] export const MonsetList = { 1:{ - 1:[1031,1032,1033,1011,1012,1013], + 1:[9001,9011,9031,9021], } } diff --git a/assets/script/game/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index 037c2c2a..a5d56aef 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -61,6 +61,38 @@ export const HeroSet = { uuid: 9009, path: "arc1", type: 2, level: 1,cost:2, name: "弓箭手", atk: 15, hp: 50, atk_dis: 200, atk_cd: 1.5, power: 0, power_max: 20, speed: 30, skill_uuid: 9003, max_skill_uuid: 1003, atktype: 2 }, + + + 1011: { + uuid: 1011, path: "orc1", type: 1, level: 1,cost:2, name: "森林兽人", atk: 5, hp: 15, atk_dis: 100, atk_cd: 2, power: 0, power_max: 20, speed: 30, + max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, atktype: 1 + }, + 1012: { + uuid: 1012, path: "orc2", type: 1, level: 1,cost:2, name: "荒野兽人", atk: 10, hp: 15, atk_dis: 100, atk_cd: 2, power: 0, power_max: 20, speed: 30, + max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, atktype: 1 + }, + 1013: { + uuid: 1013, path: "orc3", type: 1, level: 1,cost:2, name: "兽人战士", atk: 15, hp: 15, atk_dis: 100, atk_cd: 2, power: 0, power_max: 20, speed: 30, + max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, atktype: 1 + }, + + 1031: { + uuid: 1031, path: "du1", type: 1, level: 1,cost:2, name: "独眼巨人", atk: 5, hp: 15, atk_dis: 100, atk_cd: 2, power: 0, power_max: 10, speed: 30, + max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, atktype: 1 + }, + 1032: { + uuid: 1032, path: "du2", type: 1, level: 1,cost:2, name: "狂暴独眼", atk: 10, hp: 15, atk_dis: 100, atk_cd: 2, power: 0, power_max: 10, speed: 30, + max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, atktype: 1 + }, + 1033: { + uuid: 1033, path: "du3", type: 1, level: 1,cost:2, name: "独眼首领", atk: 15, hp: 15, atk_dis: 100, atk_cd: 2, power: 0, power_max: 10, speed: 30, + max_skill: "精准打击", skill_uuid: 9001, max_skill_uuid: 0, atktype: 1 + }, + 5001: { + uuid: 5001, path: "boss1", type: 1, level: 1,cost:2, name: "骷髅王", atk: 30, hp: 150, atk_dis: 200, atk_cd: 2, power: 0, power_max: 10, speed: 7, + max_skill: "精准打击", skill_uuid: 1001, max_skill_uuid: 1002, atktype: 1 + }, + } export const MonSet = { diff --git a/assets/script/game/hero/Hero.ts b/assets/script/game/hero/Hero.ts index 6ec22d8e..60240995 100644 --- a/assets/script/game/hero/Hero.ts +++ b/assets/script/game/hero/Hero.ts @@ -20,6 +20,7 @@ import { HeroSet,MonSet } from "../common/config/heroSet"; import { Role } from "../Role/Role"; import { MoveToComp } from "../common/ecs/position/MoveTo"; import { Talents } from "../common/config/TalentSet"; +import { MonModelComp } from "../mon/MonModelComp"; /** 角色实体 */ @ecs.register(`Hero`) export class Hero extends ecs.Entity { @@ -30,7 +31,7 @@ export class Hero extends ecs.Entity { protected init() { - this.addComponents( HeroModelComp); + } @@ -41,7 +42,19 @@ export class Hero extends ecs.Entity { } /** 加载角色 */ - load(pos: Vec3 = Vec3.ZERO,scale:number = -1,uuid:number=1001,layer:Node=smc.map.MapView.scene.entityLayer!.node!,index:number=-1) { + load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,layer:Node=smc.map.MapView.scene.entityLayer!.node!,index:number=-1,is_hero:boolean=true) { + let box_group= 0 + + if (is_hero) { + scale = 1 + box_group=BoxSet.HERO + this.addComponents( HeroModelComp); + }else{ + scale=-1 + box_group=BoxSet.MONSTER + this.addComponents( MonModelComp); + } + var path = "game/hero/"+smc.heros[uuid].path; var prefab: Prefab = oops.res.get(path, Prefab)!; var node = instantiate(prefab); @@ -52,17 +65,18 @@ export class Hero extends ecs.Entity { // pos.x=smc.Role.RoleView.node.position.x+pos.x; // pos.y=smc.Role.RoleView.node.position.y+pos.y; node.setPosition(pos) - this.hero_init(uuid,node,index) + this.hero_init(uuid,node,index,scale,box_group) oops.message.dispatchEvent("hero_load",this) } - hero_init(uuid:number=1001,node:Node,index:number=-1){ + 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 talents=Talents; - hv.scale = 1; + 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; diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index c9046365..355af0f1 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -105,6 +105,7 @@ export class HeroViewComp extends CCComp { 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").getChildByName("shield").active = false; // this.node.getChildByName("top").setScale(this.scale,1); // this.node.getChildByName("atk").setScale(this.scale,1); @@ -124,6 +125,7 @@ export class HeroViewComp extends CCComp { // 注册单个碰撞体的回调函数 let collider = this.getComponent(Collider2D); collider.group = this.box_group; + console.log("hero collider ",this.scale,collider); if (collider) { collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this); // collider.on(Contact2DType.END_CONTACT, this.onEndContact, this); @@ -154,22 +156,22 @@ export class HeroViewComp extends CCComp { } onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D) { - if(selfCollider.group == otherCollider.group&&selfCollider.tag==otherCollider.tag){ - if(otherCollider.node.name=="role") return - let self_x = selfCollider.node.position.x; - let other_x = otherCollider.node.position.x; - if(otherCollider.node.getComponent(HeroViewComp).type == this.type && self_x < other_x && Math.abs(other_x-self_x) < 15 ){ - this.stop_cd = 0.1; - } - // if(selfCollider.node.position.y < otherCollider.node.position.y){ - // if(selfCollider.node.getSiblingIndex() < otherCollider.node.getSiblingIndex()){ + // if(selfCollider.group == otherCollider.group&&selfCollider.tag==otherCollider.tag){ + // if(otherCollider.node.name=="role") return + // let self_x = selfCollider.node.position.x; + // let other_x = otherCollider.node.position.x; + // if(otherCollider.node.getComponent(HeroViewComp).type == this.type && self_x < other_x && Math.abs(other_x-self_x) < 15 ){ + // this.stop_cd = 0.1; + // } + // // if(selfCollider.node.position.y < otherCollider.node.position.y){ + // // if(selfCollider.node.getSiblingIndex() < otherCollider.node.getSiblingIndex()){ - // selfCollider.node.setSiblingIndex(otherCollider.node.getSiblingIndex()+1) - // // console.log("onPreSolve b:"+selfCollider.node.uuid+":"+selfCollider.node.getSiblingIndex()+"/"+otherCollider.node.uuid+":"+otherCollider.node.getSiblingIndex()); - // } + // // selfCollider.node.setSiblingIndex(otherCollider.node.getSiblingIndex()+1) + // // // console.log("onPreSolve b:"+selfCollider.node.uuid+":"+selfCollider.node.getSiblingIndex()+"/"+otherCollider.node.uuid+":"+otherCollider.node.getSiblingIndex()); + // // } - // } - } + // // } + // } if(selfCollider.group != otherCollider.group&&otherCollider.tag == 0){ this.stop_cd = 0.1; this.is_atking=true @@ -230,7 +232,10 @@ export class HeroViewComp extends CCComp { if(this.stop_cd > 0){ return } - if (this.node.position.x >= 250-this.atk_dis/2) { + if (this.node.position.x >= 360 && this.scale==1) { + return; + } + if(this.scale===-1&&this.node.position.x <= -360){ return; } // if(this.enemy){ @@ -301,14 +306,14 @@ export class HeroViewComp extends CCComp { pos.y=pos.y + y pos.x=pos.x + x - skill.load(pos,BoxSet.HERO,this.node,skill_uuid,atk,t_pos); + skill.load(pos,this.box_group,this.node,skill_uuid,atk,t_pos); // this.tooltip(3,smc.skills[skill_uuid].name,this.skill_uuid); } 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,BoxSet.HERO,this.node,this.max_skill_uuid,atk,t_pos); + skill.load(pos,this.box_group,this.node,this.max_skill_uuid,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) diff --git a/assets/script/game/map/MapMonsterComp.ts b/assets/script/game/map/MapMonsterComp.ts index 2d79a83e..69f2ec3a 100644 --- a/assets/script/game/map/MapMonsterComp.ts +++ b/assets/script/game/map/MapMonsterComp.ts @@ -171,11 +171,6 @@ export class MapMonsterComp extends CCComp { console.log("do_reward") oops.message.dispatchEvent("do_reward"); } - private addMonster(uuid:number=1001,layer:any,pos:Vec3=v3(0,0,0)) { - let monster = ecs.getEntity(Mon); - let scale = -1 - monster.load(pos,scale,uuid,layer); - } private on_other_add_monster(event: string, args: any) { var scene = smc.map.MapView.scene; @@ -262,6 +257,12 @@ export class MapMonsterComp extends CCComp { hero.load(pos,scale,uuid,monster_layer); this.set_start_point() } + private addMonster(uuid:number=1001,layer:any,pos:Vec3=v3(0,0,0)) { + let monster = ecs.getEntity(Hero); + let scale = -1 + let index = -1 + monster.load(pos,scale,uuid,layer,index,false); + } load_boss(){ let bs:any = RandomManager.instance.getRandomByObjectList(this.boss_list[this.monster_level],1)