|
@@ -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);
|
|
|
}
|