DepthCheckLocoCheck
A class in Root.Township, the global namespace.
Locomotion modifier check asset that works out how deep a smooth-locomotion player stands in a volume (for example water) and runs shallow or deep actions. It can also block teleporting into a given depth.
- Listed in Global namespace: C to D
- Inherits or implements
LocomotionModifierCheck - Nested types
Depth,ModifierCheck - Attributes
CreateAssetMenu
Constructors
| Member | What it is |
|---|---|
DepthCheckLocoCheck() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
11 private and internal fields
| Member | What it is |
|---|---|
private Dictionary<SmoothLocomotionPlayerController, DepthCheckLocoCheck.ModifierCheck> checkingPlayers | Players inside the volume and their current depth. |
private LocomotionModifierAction[] deepActions | Actions run while the player is deep. |
private float heightModifierForDepth | Share of the player's capsule height at which shallow becomes deep. |
private bool isRaycasting | Whether to find the surface by raycasting down instead of using the volume's top. |
private float minDepth | Depth below which the player counts as out. |
private float raycastHeight | How far above the feet the raycast starts. |
private LayerMask raycastMask | Layers the surface raycast hits. |
private LocomotionModifierAction[] shallowActions | Actions run while the player is shallow. |
private DepthCheckLocoCheck.Depth teleportBlock | Depths that teleporting into is blocked for. |
private static UpdateModule updateModule | Shared fixed-update module the check runs in. |
private IUnityUpdateMethod updatePositions | Registration of UpdatePositions, removed when no players are tracked. |
Methods
| Member | What it is |
|---|---|
override void Enter(SmoothLocomotionPlayerController player, Bounds bounds) | Starts tracking a player who entered the volume, with the volume's top as the surface. |
override bool IsValidTeleportationPosition(Vector3 position, PlayerController playerController, Bounds bounds) | Returns false if the target spot is at a depth listed in teleportBlock. |
override void Leave(SmoothLocomotionPlayerController player, Bounds bounds) | Stops tracking the player and finishes their current depth's actions. |
5 private and internal methods
| Member | What it is |
|---|---|
private void EnterDepth(DepthCheckLocoCheck.Depth depth, SmoothLocomotionPlayerController player) | Begins the shallow or deep actions for the player. |
private DepthCheckLocoCheck.Depth GetDepth(SmoothLocomotionPlayerController player, float surface) | Gets the player's depth below the surface (or a raycast hit): out, shallow, or deep past a share of their height. |
private DepthCheckLocoCheck.Depth GetDepth(Vector3 position, SmoothLocomotionPlayerController player, float surface) | Gets the player's depth below the surface (or a raycast hit): out, shallow, or deep past a share of their height. |
private void LeaveDepth(DepthCheckLocoCheck.Depth depth, SmoothLocomotionPlayerController player) | Finishes the shallow or deep actions for the player. |
private void UpdatePositions() | Each fixed update, switches actions for any tracked player whose depth changed. |