卡片召唤英雄
This commit is contained in:
@@ -7,6 +7,7 @@ import { Hero } from "../hero/Hero";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { Timer } from "db://oops-framework/core/common/timer/Timer";
|
||||
import { RandomManager } from "db://oops-framework/core/common/random/RandomManager";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -15,21 +16,21 @@ const { ccclass, property } = _decorator;
|
||||
@ecs.register('MissionHeroComp', false)
|
||||
export class MissionHeroCompComp extends CCComp {
|
||||
timer:Timer=new Timer(2)
|
||||
|
||||
onLoad(){
|
||||
this.on(GameEvent.UserHeroCard,this.call_hero,this)
|
||||
}
|
||||
start() {
|
||||
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
if(smc.mission.status != 1) return
|
||||
if(this.timer.update(dt)){
|
||||
this.call_hero()
|
||||
}
|
||||
|
||||
}
|
||||
call_hero(){
|
||||
call_hero(event: string, args: any){
|
||||
this.timer.reset()
|
||||
let hero_list =HeroList
|
||||
let x=RandomManager.instance.getRandomInt(0,hero_list.length,1)
|
||||
let uuid=hero_list[x]
|
||||
let uuid=args.uuid
|
||||
console.log("call_hero",uuid)
|
||||
this.addHero(uuid)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user