A class in Root.Township, Alta.Chunks.
Server: marks a networked object as a surface that random positions in its location chunk can be picked from. Needs an IPointNormalEvaluator on the same object.
Constructors
| Member | What it is |
|---|
ChunkPositionSurface() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
1 private and internal field
| Member | What it is |
|---|
private IPointNormalEvaluator surfaceDefinition | The evaluator that gives points on the surface. |
Properties
| Member | What it is |
|---|
virtual int Weight { get; } | How likely this surface is to be picked compared to others in the chunk (1 by default). Virtual. |
Methods
| Member | What it is |
|---|
PointNormal? GetPosition() | Returns a point and normal on the surface, or null if it isn't registered or has no evaluator. |
override void InitializeAsServer(SpawnData spawnData) | Registers with the entity's chunk now, or when it is added to one. |
3 private and internal methods
| Member | What it is |
|---|
private void AddToChunk(Chunk chunk) | If the chunk is a LocationChunk, registers this surface in its positions and unregisters when the entity is destroyed. |
private void Awake() | Finds the IPointNormalEvaluator on this object. |
private void Destroyed(NetworkEntity entity, bool isUnload) | Removes this surface from the chunk's positions. |
Used in
Members of other types that take, return or hold a ChunkPositionSurface: