Skip to main content

ChunkPositionSurface

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​

MemberWhat it is
ChunkPositionSurface()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
protected ChunkPositions chunkPositionsThe ChunkPositions of the location chunk this surface is registered in.
1 private and internal field
MemberWhat it is
private IPointNormalEvaluator surfaceDefinitionThe evaluator that gives points on the surface.

Properties​

MemberWhat 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​

MemberWhat 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
MemberWhat 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: