Пример #1
0
        public static float getWaterSurfaceElevation(Vector3 point)
        {
            bool  flag = false;
            float num  = -1024f;

            foreach (WaterVolume waterVolume in WaterSystem.volumes)
            {
                if (WaterUtility.isPointInsideVolume(waterVolume, point))
                {
                    return(WaterUtility.getWaterSurfaceElevation(waterVolume, point));
                }
                Ray ray;
                ray..ctor(point, new Vector3(0f, -1f, 0f));
                RaycastHit raycastHit;
                if (waterVolume.box.Raycast(ray, ref raycastHit, 2048f) && raycastHit.point.y > num)
                {
                    num  = raycastHit.point.y;
                    flag = true;
                }
            }
            if (flag)
            {
                return(num);
            }
            if (Level.info != null && Level.info.configData.Use_Legacy_Water)
            {
                return(LevelLighting.getWaterSurfaceElevation());
            }
            return(-1024f);
        }
Пример #2
0
 public static bool isPointUnderwater(Vector3 point, out WaterVolume volume)
 {
     if (Level.info != null && Level.info.configData.Use_Legacy_Water && LevelLighting.isPositionUnderwater(point))
     {
         volume = null;
         return(true);
     }
     return(WaterUtility.isPointInsideVolume(point, out volume));
 }
Пример #3
0
 public static bool isPointInsideVolume(Vector3 point, out WaterVolume volume)
 {
     for (int i = 0; i < WaterSystem.volumes.Count; i++)
     {
         volume = WaterSystem.volumes[i];
         if (WaterUtility.isPointInsideVolume(volume, point))
         {
             return(true);
         }
     }
     volume = null;
     return(false);
 }
Пример #4
0
        public static void getUnderwaterInfo(Vector3 point, out bool isUnderwater, out float surfaceElevation)
        {
            if (Level.info != null && Level.info.configData.Use_Legacy_Water)
            {
                isUnderwater     = LevelLighting.isPositionUnderwater(point);
                surfaceElevation = LevelLighting.getWaterSurfaceElevation();
            }
            else
            {
                isUnderwater     = false;
                surfaceElevation = -1024f;
            }
            WaterVolume volume;

            if (!isUnderwater && WaterUtility.isPointInsideVolume(point, out volume))
            {
                isUnderwater     = true;
                surfaceElevation = WaterUtility.getWaterSurfaceElevation(volume, point);
            }
        }
Пример #5
0
        public static bool isPointInsideVolume(Vector3 point)
        {
            WaterVolume waterVolume;

            return(WaterUtility.isPointInsideVolume(point, out waterVolume));
        }
Пример #6
0
 public static bool isPointUnderwater(Vector3 point)
 {
     return((Level.info != null && Level.info.configData.Use_Legacy_Water && LevelLighting.isPositionUnderwater(point)) || WaterUtility.isPointInsideVolume(point));
 }