Example #1
0
 private static bool Contains(WaterVolumeSubtract[] array, WaterVolumeSubtract element)
 {
     if (array == null)
     {
         return(false);
     }
     for (int i = array.Length - 1; i >= 0; i--)
     {
         if (array[i] == element)
         {
             return(true);
         }
     }
     return(false);
 }
Example #2
0
 internal override void Enable()
 {
     if (!this._CollidersAdded && Application.isPlaying)
     {
         foreach (Collider collider in this._Water.GetComponentsInChildren <Collider>(true))
         {
             WaterVolumeSubtract component = collider.GetComponent <WaterVolumeSubtract>();
             if (component == null)
             {
                 WaterVolumeAdd component2 = collider.GetComponent <WaterVolumeAdd>();
                 this.AddVolume((!(component2 != null)) ? collider.gameObject.AddComponent <WaterVolumeAdd>() : component2);
             }
         }
         this._CollidersAdded = true;
     }
     this.EnableRenderers(false);
 }
Example #3
0
 public bool IsPointInside(Vector3 point, WaterVolumeSubtract[] exclusions, float radius = 0f)
 {
     for (int i = this._Subtractors.Count - 1; i >= 0; i--)
     {
         WaterVolumeSubtract waterVolumeSubtract = this._Subtractors[i];
         if (waterVolumeSubtract.EnablePhysics && waterVolumeSubtract.IsPointInside(point) && !WaterVolume.Contains(exclusions, waterVolumeSubtract))
         {
             return(false);
         }
     }
     if (this._Boundless)
     {
         return(point.y - radius <= this._Water.transform.position.y + this._Water.MaxVerticalDisplacement);
     }
     for (int j = this._Volumes.Count - 1; j >= 0; j--)
     {
         WaterVolumeAdd waterVolumeAdd = this._Volumes[j];
         if (waterVolumeAdd.EnablePhysics && waterVolumeAdd.IsPointInside(point))
         {
             return(true);
         }
     }
     return(false);
 }
Example #4
0
 internal void RemoveSubtractor(WaterVolumeSubtract volume)
 {
     this._Subtractors.Remove(volume);
 }
Example #5
0
 internal void AddSubtractor(WaterVolumeSubtract volume)
 {
     this._Subtractors.Add(volume);
     volume.AssignTo(this._Water);
 }