Table of Contents

Class WaypointRegistry

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Server-side index of the live waypoints in every loaded scene, by Unity scene handle and authored waypoint index.

public static class WaypointRegistry
Inheritance
WaypointRegistry
Inherited Members

Remarks

A fast-travel request names a waypoint by (scene, index), not by scene-object ID: the waypoint may be on the far side of the zone, outside the requesting client's observer range, so the client has no object ID to send. The server resolves the pair here against the objects actually loaded, which also means the destination position comes from the live transform rather than from a cache that could be stale.

Keyed by scene handle rather than name because scene stacking loads several copies of one scene (instances) into one process, and a character in one instance must land at the waypoint in that instance. Waypoints register in OnStartServer and unregister in OnStopServer, which is also what an unloaded scene calls on its objects.

Methods

Clear()

Drops every registration. Tests, and process teardown.

public static void Clear()

CollectIndices(int, List<int>)

Appends the indices registered in a scene, in no particular order.

public static void CollectIndices(int sceneHandle, List<int> results)

Parameters

sceneHandle int
results List<int>

Count(int)

Number of waypoints registered in a scene.

public static int Count(int sceneHandle)

Parameters

sceneHandle int

Returns

int

Register(IWaypoint)

Adds a waypoint. A duplicate index in the same scene is refused and reported, since two waypoints sharing a bit would let discovering one unlock the other.

public static bool Register(IWaypoint waypoint)

Parameters

waypoint IWaypoint

Returns

bool

True when registered.

TryGet(int, int, out IWaypoint)

Finds a live waypoint by scene handle and index.

public static bool TryGet(int sceneHandle, int waypointIndex, out IWaypoint waypoint)

Parameters

sceneHandle int
waypointIndex int
waypoint IWaypoint

Returns

bool

Unregister(IWaypoint)

Removes a waypoint, if it is the one registered under its index.

public static void Unregister(IWaypoint waypoint)

Parameters

waypoint IWaypoint