Skip to main content
GameDev.net gamedev.net
Experimental

TowerDef (Showcase)

About This Project

  • Single CancellationToken from IGameState — enemies, towers and WaveManager link via CreateLinkedTokenSource; game over cancels all async loops at once

  • Interfaces (IEnemyRegistry, IEnemyFactory, IGameState) — systems never reference each other concretely, testable in isolation

  • Zenject DI — constructor injection for plain classes, field injection for MonoBehaviour; no global state

  • Addressables (InstantiateAsync + InjectGameObject) — async spawning: instantiate, inject, initialize; assets load on demand

  • UniTask over coroutines — cancellable, allocation-free; async loops live exactly as long as the object

  • SOLID in practice — EnemyRegistry stores, EnemyFactory creates, GameState owns lives and token, WaveManager spawns waves

  • LINQ-free hot path — manual foreach with one Vector3.Distance per enemy in the firing loop, zero allocations

  • Built with Unity 6000.5.2f1, URP

Comments

Discussion

Loading comments...