wuwangdong 4 anni fa
parent
commit
5c10737dd0
1 ha cambiato i file con 11 aggiunte e 9 eliminazioni
  1. 11 9
      assets/script/game/game/Game.ts

+ 11 - 9
assets/script/game/game/Game.ts

@@ -216,17 +216,19 @@ export default class Game extends cc.Component {
         gData.gameData.init_coin = false;
 
         if (gData.gameData.addHb > 0) {
-            let add =  Math.round(gData.gameData.addHb / 100);
-            this.lbl_addHb.string = "+" + add.toString();
+            let add = Math.round(gData.gameData.addHb / 100);
             gData.gameData.addHb = 0;
-
+            if(add > 0)
             {
-                cc.Tween.stopAllByTarget(this.node_addHb);
-                this.node_addHb.active = true;
-                this.node_addHb.scale = 0;
-                cc.tween(this.node_addHb).to(0.1, { scale: 1 }).delay(1.5).call(() => {
-                    this.node_addHb.active = false;
-                }).start();
+                this.lbl_addHb.string = "+" + add.toString();
+                {
+                    cc.Tween.stopAllByTarget(this.node_addHb);
+                    this.node_addHb.active = true;
+                    this.node_addHb.scale = 0;
+                    cc.tween(this.node_addHb).to(0.1, { scale: 1 }).delay(1.5).call(() => {
+                        this.node_addHb.active = false;
+                    }).start();
+                }
             }
         }
     }