英雄召唤修改为到特定位置 取消类型与位置绑定
This commit is contained in:
@@ -13531,7 +13531,7 @@
|
||||
}
|
||||
],
|
||||
"_interactable": true,
|
||||
"_transition": 0,
|
||||
"_transition": 3,
|
||||
"_normalColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
@@ -13575,11 +13575,13 @@
|
||||
},
|
||||
{
|
||||
"__type__": "cc.ClickEvent",
|
||||
"target": null,
|
||||
"target": {
|
||||
"__id__": 2
|
||||
},
|
||||
"component": "",
|
||||
"_componentId": "",
|
||||
"handler": "",
|
||||
"customEventData": ""
|
||||
"_componentId": "0e186v7IoJEnZ9QdXVZry2W",
|
||||
"handler": "call_hero",
|
||||
"customEventData": "0"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
|
||||
@@ -23,6 +23,7 @@ export class MissionHeroCompComp extends CCComp {
|
||||
1:{pos:v3(-270,205,0),has:false},
|
||||
2:{pos:v3(-270,65,0),has:false},
|
||||
}
|
||||
current_hero_uuid:number=0
|
||||
onLoad(){
|
||||
this.on(GameEvent.UseHeroCard,this.show_heros_pos,this)
|
||||
}
|
||||
@@ -41,31 +42,41 @@ export class MissionHeroCompComp extends CCComp {
|
||||
test_call(){
|
||||
this.addHero(5010)
|
||||
}
|
||||
show_heros_pos(){
|
||||
show_heros_pos(event: string, args: any){
|
||||
console.log("show_heros_pos",args)
|
||||
|
||||
this.current_hero_uuid=args.uuid
|
||||
this.node.getChildByName("herospos").active=true
|
||||
}
|
||||
call_hero(event: string, args: any){
|
||||
this.node.getChildByName("herospos").active=false
|
||||
console.log("call_hero",args)
|
||||
let hero_pos=0
|
||||
if(args.hero_pos){
|
||||
hero_pos=args.hero_pos
|
||||
}
|
||||
this.timer.reset()
|
||||
let hero_list =HeroList
|
||||
let x=RandomManager.instance.getRandomInt(0,hero_list.length,1)
|
||||
let uuid=args.uuid
|
||||
console.log("call_hero",uuid)
|
||||
this.addHero(uuid)
|
||||
// let uuid=args.uuid
|
||||
// console.log("call_hero",uuid)
|
||||
this.addHero(this.current_hero_uuid,hero_pos)
|
||||
}
|
||||
|
||||
/** 添加玩家 */
|
||||
private addHero(uuid:number=1001) {
|
||||
private addHero(uuid:number=1001,hero_pos:number=0) {
|
||||
console.log("call_hero addHero",uuid)
|
||||
let info:any={ap:0,hp:0}
|
||||
if(this.start_pos[HeroInfo[uuid].type].has){
|
||||
info=this.get_info_and_remove(HeroInfo[uuid].type,uuid)
|
||||
if(this.start_pos[hero_pos].has){
|
||||
info=this.get_info_and_remove(hero_pos,uuid)
|
||||
}
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
let scale = 1
|
||||
let pos:Vec3 = this.start_pos[HeroInfo[uuid].type].pos;
|
||||
let pos:Vec3 = this.start_pos[hero_pos].pos;
|
||||
console.log("hero load0",pos,this.start_pos)
|
||||
hero.load(pos,scale,uuid,info);
|
||||
this.start_pos[HeroInfo[uuid].type].has=true
|
||||
this.start_pos[hero_pos].has=true
|
||||
this.current_hero_uuid=0
|
||||
}
|
||||
|
||||
get_info_and_remove(type:number,uuid:number){
|
||||
|
||||
Reference in New Issue
Block a user