dd
This commit is contained in:
@@ -38,7 +38,7 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
/** 下级经验 */
|
||||
speed : 0,
|
||||
hp: {
|
||||
min:30,
|
||||
min:20,
|
||||
max:30
|
||||
},
|
||||
power: {
|
||||
@@ -49,6 +49,11 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
min: 0,
|
||||
max: 10
|
||||
},
|
||||
shuaxin: {
|
||||
min: 0,
|
||||
max: 20,
|
||||
speed:1,
|
||||
},
|
||||
|
||||
};
|
||||
vmAdd() {
|
||||
|
||||
@@ -28,9 +28,10 @@ export class MapViewComp extends CCComp {
|
||||
onLoad(){
|
||||
// 监听全局事件
|
||||
oops.message.on("monster_load", this.onMonsterLoaded, this);
|
||||
this.addHero();
|
||||
}
|
||||
private onMonsterLoaded(event: string, args: any) {
|
||||
console.log('on_monster_load');
|
||||
// console.log('on_monster_load');
|
||||
}
|
||||
reset(): void {
|
||||
|
||||
@@ -43,16 +44,20 @@ export class MapViewComp extends CCComp {
|
||||
|
||||
/** 转场 */
|
||||
protected update(dt: number): void {
|
||||
if (this.timer.update(dt)) {
|
||||
// console.log('每2秒触发一次');
|
||||
this.addHero();
|
||||
}
|
||||
|
||||
this.shuaxin(dt)
|
||||
}
|
||||
|
||||
private mapLoaded() {
|
||||
|
||||
}
|
||||
|
||||
shuaxin(dt: number) {
|
||||
smc.vm_data.shuaxin.min += smc.vm_data.shuaxin.speed*dt;
|
||||
if (smc.vm_data.shuaxin.min >= smc.vm_data.shuaxin.max) {
|
||||
smc.vm_data.shuaxin.min = 0;
|
||||
this.addHero();
|
||||
}
|
||||
}
|
||||
/** 添加玩家 */
|
||||
private addHero() {
|
||||
this.scene.node.active = true
|
||||
|
||||
Reference in New Issue
Block a user