A class in Root.Township, the global namespace.
Fixed list of spawn points for a population, either live child transforms or positions and rotations cached relative to this object.
Constructors
| Member | What it is |
|---|
SpawnPositions() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private bool btnCache | Inspector button that calls Cache. |
private static Logger logger | NLog logger for this class. |
private Vector3[] positions | Cached local positions, used when no transforms are set. |
private Quaternion[] rotations | Cached local rotations matching positions. |
private Transform[] transforms | Spawn point transforms; when not empty they win over the cached arrays. |
Properties
| Member | What it is |
|---|
int Count { get; } | Number of spawn points: the transforms if any are set, else the cached positions. |
Methods
| Member | What it is |
|---|
void Cache() | Editor: copies the transforms' local positions and rotations into the arrays, then clears the transform list. |
SpawnPoint GetLocalSpawnPosition(int index) | Returns spawn point index in local space; logs an error and returns null if the index is bad. |
SpawnPoint GetSpawnPosition(int index) | Returns spawn point index in world space; logs an error and returns null if the index is bad. |
2 private and internal methods
| Member | What it is |
|---|
private void OnValidate() | Editor: runs the cache button and keeps the rotations array the same length as the positions. |
private void ISpawnPositions.SetSize(float size) | Part of ISpawnPositions; does nothing here. |
Used in
Members of other types that take, return or hold a SpawnPositions: