File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -25,16 +25,15 @@ public void Start()
2525
2626 _vfxPools = new Dictionary < VfxType , Transform > ( ) ;
2727
28- GameObject g ;
29- Transform smokePool = Instantiate ( poolPrefab ) . transform ;
28+ Transform smokePool = Instantiate ( poolPrefab , transform ) . transform ;
3029 smokePool . gameObject . name = "Smoke" ;
3130 _vfxPools [ VfxType . Smoke ] = smokePool ;
32- smokePool . SetParent ( transform ) ;
3331 Transform smokeStockParent = smokePool . Find ( "Stock" ) ;
3432 for ( int i = 0 ; i < SMOKE_EFFECT_POOL_SIZE ; i ++ )
3533 {
36- g = Instantiate ( smokeEffectPrefabs [ Random . Range ( 0 , smokeEffectPrefabs . Length ) ] ) ;
37- g . transform . SetParent ( smokeStockParent ) ;
34+ Instantiate (
35+ smokeEffectPrefabs [ Random . Range ( 0 , smokeEffectPrefabs . Length ) ] ,
36+ smokeStockParent ) ;
3837 }
3938 }
4039
Original file line number Diff line number Diff line change @@ -152,12 +152,16 @@ public void RemoveConstructor(int index)
152152 _constructors . RemoveAt ( index ) ;
153153 EventManager . TriggerEvent ( "UpdatedConstructors" , this ) ;
154154
155- // when removing last constructor, remove smoke VFX
156- foreach ( Transform vfx in _smokeVfx )
157- VFXManager . instance . Unspawn ( VfxType . Smoke , vfx ) ;
158- _smokeVfx . Clear ( ) ;
159- // stop construction sound
160- _buildingManager . ambientSource . Pause ( ) ;
155+ // when removing last constructor:
156+ if ( _constructors . Count == 0 )
157+ {
158+ // - remove smoke VFX
159+ foreach ( Transform vfx in _smokeVfx )
160+ VFXManager . instance . Unspawn ( VfxType . Smoke , vfx ) ;
161+ _smokeVfx . Clear ( ) ;
162+ // - stop construction sound
163+ _buildingManager . ambientSource . Pause ( ) ;
164+ }
161165 }
162166
163167 private void _SetAlive ( bool fromSavedData = false )
You can’t perform that action at this time.
0 commit comments