dd
This commit is contained in:
@@ -21,24 +21,18 @@ export class MapViewComp extends CCComp {
|
||||
scene: MapViewScene = null!;
|
||||
current_map: any;
|
||||
private game_timer: Timer = new Timer(1);
|
||||
private monster_refresh_rtimer: Timer = new Timer(3);
|
||||
|
||||
|
||||
private mapLoaded() {
|
||||
|
||||
}
|
||||
async onLoad(){
|
||||
// 监听全局事件
|
||||
oops.message.on("do_add_monster", this.on_do_add_monster, this);
|
||||
oops.message.on("do_add_hero", this.on_do_add_hero, this);
|
||||
|
||||
}
|
||||
private on_do_add_monster(event: string, args: any) {
|
||||
this.addMonster()
|
||||
}
|
||||
|
||||
/**监听do_add_hero 添加hero,通过uuid */
|
||||
private on_do_add_hero(event: string, args: any) {
|
||||
console.log("do_add_hero",args.uuid)
|
||||
// console.log("do_add_hero",args.uuid)
|
||||
this.addHero(args.uuid)
|
||||
}
|
||||
reset(): void {
|
||||
@@ -54,22 +48,15 @@ export class MapViewComp extends CCComp {
|
||||
// console.log("heros",heros)
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
if (this.monster_refresh_rtimer.update(dt)) {
|
||||
// 刷新怪物定时器
|
||||
this.monster_refresh()
|
||||
}
|
||||
if (this.game_timer.update(dt)) {
|
||||
smc.vm_data.game.g_time += 1;
|
||||
}
|
||||
|
||||
// if (this.game_timer.update(dt)) {
|
||||
// smc.vm_data.game.g_time += 1;
|
||||
// }
|
||||
// this.shuaxin(dt)
|
||||
this.gold_add(dt)
|
||||
}
|
||||
// 刷新怪物
|
||||
monster_refresh(){
|
||||
if(smc.monsters.length > 0 ){
|
||||
this.addMonster(smc.monsters[0].uuid)
|
||||
}
|
||||
}
|
||||
|
||||
gold_add(dt: number) {
|
||||
smc.vm_data.gold.time += dt;
|
||||
if (smc.vm_data.gold.time >= smc.vm_data.gold.cd) {
|
||||
@@ -94,13 +81,6 @@ export class MapViewComp extends CCComp {
|
||||
let camp = 1
|
||||
hero.load(pos,camp,uuid);
|
||||
}
|
||||
private addMonster(uuid:number=1001) {
|
||||
this.scene.node.active = true
|
||||
let monster = ecs.getEntity<Monster>(Monster);
|
||||
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
|
||||
let camp = -1
|
||||
monster.load(pos,camp,uuid);
|
||||
smc.monsters.splice(0,1)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -22,16 +22,20 @@ export default class SkillLayer extends Component {
|
||||
@property(Prefab)
|
||||
light: Prefab = null;
|
||||
onLoad(){
|
||||
oops.message.on("monster_load", this.onMonsterLoaded, this);
|
||||
oops.message.on("hero_load", this.onHeroLoaded, this);
|
||||
oops.message.on("monster_load", this.doMonsterLoad, this);
|
||||
oops.message.on("hero_load", this.doHeroLoad, this);
|
||||
oops.message.on("do_use_skill", this.doSkill, this);
|
||||
|
||||
}
|
||||
onMonsterLoaded(){
|
||||
doSkill(){
|
||||
// console.log("doSkill")
|
||||
}
|
||||
doMonsterLoad(){
|
||||
// const light = instantiate(this.light);
|
||||
// light.setPosition(300,-30,0);
|
||||
// this.node.addChild(light);
|
||||
}
|
||||
onHeroLoaded(){
|
||||
doHeroLoad(){
|
||||
const light = instantiate(this.light);
|
||||
light.setPosition(BoxSet.HERO_START,BoxSet.GAME_LINE,0);
|
||||
this.node.addChild(light);
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { _decorator, Component, Node, sp } from 'cc';
|
||||
const { ccclass, property ,} = _decorator;
|
||||
|
||||
@ccclass('once')
|
||||
export class once extends Component {
|
||||
private spine!: sp.Skeleton;
|
||||
|
||||
start() {
|
||||
|
||||
}
|
||||
protected onLoad(): void {
|
||||
this.spine = this.getComponent(sp.Skeleton)!;
|
||||
this.spine.setCompleteListener(trackEntry => {
|
||||
this.node.destroy()
|
||||
});
|
||||
|
||||
}
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"6e0a995d-16c1-4554-8f80-29394f24213b","files":[],"subMetas":{},"userData":{}}
|
||||
Reference in New Issue
Block a user