Skip to content
This repository was archived by the owner on Aug 14, 2019. It is now read-only.

SpawnPoint.cs

Erik edited this page Apr 25, 2019 · 5 revisions

Script: SpawnPoint.cs


Dependencies (What do I need to include to use this script in another project?):
PublicMethods:
  • StartSpawning(GameObject go) - Currently public, should be protected instead. This is only needed by internal methods and derived classes.
  • SpawnObject() - Spawns the configured objectPrefab. This can be overridden by a derived class to make a unique implementation.
  • SpawnEnemiesControl() - Coroutine that spawns an object every spawnDelay seconds. Should be refactored to a more generic name.
Public Events:
  • None
Configurable Fields:
  • objectPrefab - Object that will be spawned.
  • maximumSpawns - Maximum number of objects this Spawn Point can spawn
  • spawnDelay - Seconds between spawn.
  • triggers - Array of all triggers that can initiate spawning.
General Overview:

When a player collides with a configured trigger StartSpawning is invoked. The basic SpawnPoint.cs spawns enemies every spawnDelay seconds, but this can be derived and the SpawnObject() method can be overridden to spawn and configure any prefab object. It is recommended to take advantage of the ObjectPooler.

Clone this wiki locally