ChunkBasedEnvironment
A class in Root.Township, the global namespace.
Client: switches the player's environment to the EnvironmentNode of the location chunk they walk into.
- Listed in Global namespace: C to D
- Inherits or implements
MonoBehaviour
Constructors
| Member | What it is |
|---|---|
ChunkBasedEnvironment() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|---|
private LocationChunk chunk | Location chunk found for the latest position. |
private EnvironmentHandler environmentAssesser | The EnvironmentHandler on this object. |
private LocomotionController locomotion | Locomotion controller whose moves are watched. |
private LocationChunk oldChunk | Location chunk the player was last in. |
Methods
2 private and internal methods
| Member | What it is |
|---|---|
private void PositionChanged(PlayerController player, Vector3 oldPosition, Vector3 newPosition, LocomotionFunction function) | On each move, finds the best location chunk for the new position and, if it changed, sets its environment without snapping. |
private void Start() | Gets the EnvironmentHandler and hooks the locomotion position event. |