PouchSpawner
A class in Root.Township, the global namespace.
Server: spawner that places an item, or a stack of it inside a pouch when the count is more than one and the item can be picked up.
- Listed in Global namespace: P
- Inherits or implements
SpawnerBase
Constructors
| Member | What it is |
|---|---|
PouchSpawner() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
| Member | What it is |
|---|---|
private AttributeUsage count | How many to spawn, read from chunk attributes. |
private int countToSpawn | Count worked out for the current spawn. |
private Distribution distribution | Distribution to pick the item from when prefab is not set. |
private static Logger logger | NLog logger for this class. |
private NetworkPrefab prefab | Item to spawn. Use this or distribution. |
private NetworkPrefab prefabToSpawn | Item picked for the current spawn. |
Methods
| Member | What it is |
|---|---|
override void Spawn() | Server: works out the count from chunk attributes, picks the prefab and spawns it or a pouch. Refuses to put a pouch in a pouch. |
protected override void OnSpawn(NetworkEntity spawned) | When a pouch spawns, spawns the item and docks countToSpawn of it into the pouch. |