Kziwws 3 hari lalu
induk
melakukan
ab18871651
2 mengubah file dengan 7 tambahan dan 6 penghapusan
  1. 2 2
      assets/data/csv/sundries.csv
  2. 5 4
      assets/scripts/items/base/BulletBase.ts

+ 2 - 2
assets/data/csv/sundries.csv

@@ -1,7 +1,7 @@
-ID,名称,生命值,爆炸伤害,爆炸半径(油桶半径的5倍2.24 车头5车的半径)
+ID,名称,生命值,爆炸伤害,爆炸半径(油桶半径的6倍2.5  车头5车的半径)
 number,string,number,number,number
 id,name,hp,explosion_injury,explosion_radius
 11001,沙袋堆,100,,
-11002,油桶,50,100,2.24
+11002,油桶,50,100,2.5
 11003,军车,200,300,4.1
 11004,小沙袋,20,,

+ 5 - 4
assets/scripts/items/base/BulletBase.ts

@@ -21,7 +21,7 @@ export class BulletBase extends Component {
     }
     
     start() {
-        this.scheduleOnce(this.autoRecycle.bind(this),this.recycleTime);
+        setTimeout(this.autoRecycle.bind(this),this.recycleTime * 1000);
     }
 
     /**
@@ -55,11 +55,11 @@ export class BulletBase extends Component {
                    impact.forward = e.hitNormal.multiplyScalar(-1);
                    impact.setParent(e.collider.node,true);
                 }
-                this.scheduleOnce(()=>{
+                setTimeout(()=>{
                     if(impact.parent){
                        PoolManager.putNode(impact);
                     }
-                },3);
+                },3 * 1000);
             })
             .catch((error: Error) => {
                 console.error("加载sundries/hit_impact异常", error);
@@ -87,7 +87,8 @@ export class BulletBase extends Component {
      * 自动回收子弹
      */
     public autoRecycle(){
-        if(!this.isDead){
+        if(!this.isDead 
+            && this.node.parent){
             this.isDead = true;
             PoolManager.putNode(this.node);
         }