A class in Root.Township, the global namespace.
Trigger volume that changes smooth locomotion for players inside it, through a LocomotionModifierCheck (for example water). Also decides whether teleporting into it is allowed.
Constructors
| Member | What it is |
|---|
LocomotionModifier() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
| Member | What it is |
|---|
private Bounds bounds | Bounds passed to the check, set by hand or from child colliders. |
private bool calculateBoundsOnStart | Work out bounds from child colliders at start or bake (default true). |
private LocomotionModifierCheck check | The check that applies the locomotion change on enter and leave. |
private Dictionary<Collider, int> currentPlayers | Per collider count of overlapping triggers, so nested colliders count once. |
private bool IsSafeInside | Value given to the player's SmoothLocomotion.IsSafe while inside. Set back to true on leaving. |
private static Dictionary<Collider, SmoothLocomotionPlayerController> playerMap | Static cache from a player's collider to its smooth locomotion player controller. |
Properties
1 private and internal property
| Member | What it is |
|---|
private int IBuildRendererBakeable.SortingOrder { get; } | Always 0. |
Methods
| Member | What it is |
|---|
static bool IsValidTeleportationPosition(Vector3 position, PlayerController player) | Checks every water layer modifier at the position and returns false if any check refuses the teleport. |
void OnTriggerEnter(Collider other) | Counts a player's collider in. On first entry sets IsSafe, calls the check's enter and OnPlayerEntered. |
void OnTriggerExit(Collider other) | Counts a collider out. On the last one, calls the check's leave and OnPlayerLeft. |
protected virtual void OnDrawGizmosSelected() | Draws the bounds in the editor. |
protected virtual void OnPlayerEntered(SmoothLocomotionPlayerController player) | Override hook: a player came in. |
protected virtual void OnPlayerLeft(SmoothLocomotionPlayerController player) | Override hook: a player left or was destroyed. |
7 private and internal methods
| Member | What it is |
|---|
private void AutoCalculateBounds() | Sets bounds to cover all child colliders and turns off recalculating. |
private void IBuildRendererBakeable.Bake(bool isSaving) | Build bake: calculates the bounds ahead of time if set to. |
private void IBuildRendererBakeable.Clean() | Empty build clean step. |
private void OnDestroy() | Runs leave logic for every player still inside. |
private void RemovePlayer(NetworkPrefab prefab) | Calls the check's leave and OnPlayerLeft for a player, also when their prefab is destroyed. |
private void RemovePlayer(SmoothLocomotionPlayerController player) | Calls the check's leave and OnPlayerLeft for a player, also when their prefab is destroyed. |
private void Start() | Calculates the bounds if set to. |
Used in
Members of other types that take, return or hold a LocomotionModifier: