dd
This commit is contained in:
@@ -54,6 +54,11 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
max: 20,
|
||||
speed:1,
|
||||
},
|
||||
gold_add: {
|
||||
min: 0,
|
||||
max: 10,
|
||||
speed:2,
|
||||
},
|
||||
|
||||
};
|
||||
vmAdd() {
|
||||
|
||||
@@ -28,7 +28,6 @@ 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');
|
||||
@@ -46,10 +45,21 @@ export class MapViewComp extends CCComp {
|
||||
protected update(dt: number): void {
|
||||
|
||||
this.shuaxin(dt)
|
||||
this.gold_add(dt)
|
||||
}
|
||||
|
||||
private mapLoaded() {
|
||||
|
||||
}
|
||||
gold_add(dt: number) {
|
||||
smc.vm_data.gold_add.min += smc.vm_data.gold_add.speed*dt;
|
||||
if (smc.vm_data.gold_add.min >= smc.vm_data.gold_add.max) {
|
||||
smc.vm_data.gold_add.min = 0;
|
||||
if (smc.vm_data.gold.min < smc.vm_data.gold.max) {
|
||||
smc.vm_data.gold.min = smc.vm_data.gold.min + 1
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
shuaxin(dt: number) {
|
||||
smc.vm_data.shuaxin.min += smc.vm_data.shuaxin.speed*dt;
|
||||
|
||||
Reference in New Issue
Block a user