WorldLandmarkManager
A class in Root.Township, Alta.Chunks.
Loads and unloads world landmarks (stand-in models of distant places) as the chunks they depend on load. Runs on clients, and on the server only in local test. Also the landmarks console module.
- Listed in World, chunks and saving
- Inherits or implements
NetworkEntityBehaviour - Attributes
PlayOnly,Module
Constructors
| Member | What it is |
|---|---|
WorldLandmarkManager() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private WorldLandmark[] androidLandmarks | Landmarks used on Android. |
private static WorldLandmarkManager instance | The current manager. |
private bool isSetup | True between Setup and Stop. |
private WorldLandmark[] landmarks | Landmarks used on Windows. |
private static Logger logger | NLog logger for this class. |
private Dictionary<Chunk, HashSet<WorldLandmark>> toLoad | Landmarks shown when each chunk loads. |
private Dictionary<Chunk, HashSet<WorldLandmark>> toUnload | Landmarks hidden when each static chunk loads. |
Properties
| Member | What it is |
|---|---|
static bool IsLandmarkLoadingEnabled { get; set; } | Global switch for landmark loading. Default true. |
WorldLandmark[] Landmarks { get; set; } | The landmarks for this platform: the Android list on Android, the main list on Windows, otherwise null. |
Methods
| Member | What it is |
|---|---|
static void ForceUnloadAll() | Unloads every landmark. |
override void Initialize() | Client: sets up if landmark loading is enabled. |
override void InitializeAsServer(SpawnData spawnData) | Server: sets up only in local test. |
11 private and internal methods
| Member | What it is |
|---|---|
private void AttemptLoadLandmark(Chunk chunk) | When a chunk fully loads, loads its landmarks that have a loaded chunk and none of their static chunks loaded. |
private void AttemptLoadLandmarkFromStatic(Chunk chunk) | When a static chunk begins unloading, loads the landmarks it was hiding and holds the unload until they finish. |
private void AttemptUnloadLandmark(Chunk chunk) | When a chunk fully unloads, asks its landmarks to check whether they should unload. |
private void Awake() | Sets the static instance. |
private static void EnableLandmarks(bool enabled) | Console landmarks enable: sets up or stops the manager. |
private void ForceUnloadLandmark(Chunk chunk) | When a static chunk fully loads, unloads the landmarks it replaces. |
private void OnDestroy() | Stops the manager and clears the instance. |
private void ResolveChunkReferences() | Has each landmark find its chunks. |
private static void SetLoadingEnabled(bool isLoading) | Console landmarks load-enabled: sets IsLandmarkLoadingEnabled and sets up if turned on. |
private void Setup() | Hooks each landmark's chunks' load and unload events, then loads the landmarks that should already show. |
private void Stop() | Unhooks all chunk events and resets each landmark. |