Update SpawnObjectManager.ts
parent
d1a218f16b
commit
790c0e7a59
|
@ -56,11 +56,6 @@ export class SpawnObjectManager extends Component {
|
|||
const prefab = this._objects[i].prefab;
|
||||
this._pools[i] = new ObjectPool(prefab, 10, true, ScoreObject);
|
||||
}
|
||||
|
||||
this._weights = this._objects.map((obj) => {
|
||||
obj.currentWeight = obj.weight;
|
||||
return obj.currentWeight;
|
||||
});
|
||||
}
|
||||
|
||||
protected update(dt: number): void {
|
||||
|
@ -112,6 +107,10 @@ export class SpawnObjectManager extends Component {
|
|||
for (let i = 0; i < randomRangeInt(5, 10); i++) {
|
||||
this.spawn();
|
||||
}
|
||||
this._weights = this._objects.map((obj) => {
|
||||
obj.currentWeight = obj.weight;
|
||||
return obj.currentWeight;
|
||||
});
|
||||
break;
|
||||
case GameState.GameOver:
|
||||
this._playing = false;
|
||||
|
|
Loading…
Reference in New Issue