Пример #1
0
 private void addVolumeProperties(SurfaceSwimProperties properties)
 {
     if (properties != null && !volumeProperties.Contains(properties))
     {
         volumeProperties.Add(properties);
         setVolumeProperties(properties);
     }
 }
Пример #2
0
        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;
            }
        }
Пример #3
0
        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();
            }
        }
Пример #4
0
        private SurfaceSwimProperties removeVolumeTriggerProperties(Collider trigger)
        {
            SurfaceSwimProperties value = null;

            if (volumeTriggerProperties.TryGetValue(trigger, out value))
            {
                volumeTriggerProperties.Remove(trigger);
                removeVolumeProperties(value);
            }
            return(value);
        }
Пример #5
0
 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;
         }
     }
 }
Пример #6
0
 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);
     }
 }