Adding the feature to sell towers with VFX and audio included

This commit is contained in:
Matt F 2026-07-14 23:15:34 -07:00
parent 1794f65b19
commit 0b4cde4590
16 changed files with 5394 additions and 13 deletions

View file

@ -65,7 +65,15 @@ namespace TD.VFX
if (coinBurstPrefab != null)
{
Instantiate(coinBurstPrefab, spawnPos, Quaternion.identity);
var instance = Instantiate(coinBurstPrefab, spawnPos, Quaternion.identity);
// Force the burst to play. The spawner's whole job is to play this effect, so
// it shouldn't depend on the prefab's ParticleSystem having "Play On Awake"
// ticked — if that's off, the effect would silently never appear. Harmless when
// Play On Awake is already on (a freshly instantiated one-shot just restarts at
// t=0). VFX Graph effects play from their own settings, so a null PS is fine.
var ps = instance.GetComponentInChildren<ParticleSystem>();
if (ps != null) ps.Play(withChildren: true);
}
else
{