private void addVolumeProperties(SurfaceSwimProperties properties)
 {
     if (properties != null && !volumeProperties.Contains(properties))
     {
         volumeProperties.Add(properties);
         setVolumeProperties(properties);
     }
 }
        private void OnTriggerExit(Collider trigger)
        {
            SurfaceSwimProperties surfaceSwimProperties = removeVolumeTriggerProperties(trigger);

            if (curState != State.Resurfacing && curState != State.QuickResurfacing && volumeProperties.Count == 0 && (surfaceSwimProperties != null || trigger.CompareTag(LocomotionUtils.WaterVolumeTag)))
            {
                curState = State.ExitingWater;
            }
        }
        private void OnTriggerStay(Collider trigger)
        {
            SurfaceSwimProperties surfaceSwimProperties = getVolumeTriggerProperties(trigger);

            if (!base.enabled && Active && (tracker.IsCurrentControllerOfType <RunController>() || (tracker.IsCurrentControllerOfType <SlideController>() && (tracker.GetCurrentController() as SlideController).CurrentMode == SlideController.Mode.Animated)) && surfaceSwimProperties != null && (surfaceSwimProperties.Type == SurfaceSwimProperties.VolumeType.Diving || !isWaterTooShallow(mutableData.MaxShallowWaterDepth + mutableData.ShallowWaterDepthHysteresis)))
            {
                tracker.SetCurrentController <SwimController>();
                enableWaterEffects();
            }
        }
        private SurfaceSwimProperties removeVolumeTriggerProperties(Collider trigger)
        {
            SurfaceSwimProperties value = null;

            if (volumeTriggerProperties.TryGetValue(trigger, out value))
            {
                volumeTriggerProperties.Remove(trigger);
                removeVolumeProperties(value);
            }
            return(value);
        }
 private void setVolumeProperties(SurfaceSwimProperties properties)
 {
     if (properties != null)
     {
         isInShallowWater     = properties.Type == SurfaceSwimProperties.VolumeType.SurfaceSwimming;
         visibleSurfaceHeight = (properties.SpecifyValuesInLocalSpace ? (properties.VisibleSurfaceHeight + properties.ObjectOrigin.position.y) : properties.VisibleSurfaceHeight);
         logicalSurfaceHeight = visibleSurfaceHeight + properties.SinkOffset;
         if (swim != null)
         {
             swim.IsInShallowWater = isInShallowWater;
         }
     }
 }
 private void removeVolumeProperties(SurfaceSwimProperties properties)
 {
     if (!(properties != null) || !volumeProperties.Contains(properties))
     {
         return;
     }
     if (volumeProperties.IndexOf(properties) == volumeProperties.Count - 1)
     {
         volumeProperties.Remove(properties);
         if (volumeProperties.Count > 0)
         {
             setVolumeProperties(volumeProperties[volumeProperties.Count - 1]);
         }
     }
     else
     {
         volumeProperties.Remove(properties);
     }
     if (volumeProperties.Count == 0)
     {
         setVolumeProperties(null);
     }
 }