Exemplo n.º 1
0
 public static bool ApplyTerrainFilters(this Transform transform, TerrainFilter[] filters, Vector3 pos, Quaternion rot, Vector3 scale, SpawnFilter globalFilter = null)
 {
     if (filters.Length == 0)
     {
         return(true);
     }
     for (int i = 0; i < (int)filters.Length; i++)
     {
         TerrainFilter terrainFilter = filters[i];
         Vector3       vector3       = Vector3.Scale(terrainFilter.worldPosition, scale);
         vector3 = rot * vector3;
         Vector3 vector31 = pos + vector3;
         if (TerrainMeta.OutOfBounds(vector31))
         {
             return(false);
         }
         if (globalFilter != null && globalFilter.GetFactor(vector31) == 0f)
         {
             return(false);
         }
         if (!terrainFilter.Check(vector31))
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 2
0
 public static bool ApplyTerrainFilters(
     this Transform transform,
     TerrainFilter[] filters,
     Vector3 pos,
     Quaternion rot,
     Vector3 scale,
     SpawnFilter globalFilter = null)
 {
     if (filters.Length == 0)
     {
         return(true);
     }
     for (int index = 0; index < filters.Length; ++index)
     {
         TerrainFilter filter    = filters[index];
         Vector3       vector3_1 = Vector3.Scale(filter.worldPosition, scale);
         Vector3       vector3_2 = Quaternion.op_Multiply(rot, vector3_1);
         Vector3       vector3_3 = Vector3.op_Addition(pos, vector3_2);
         if (TerrainMeta.OutOfBounds(vector3_3) || globalFilter != null && (double)globalFilter.GetFactor(vector3_3) == 0.0 || !filter.Check(vector3_3))
         {
             return(false);
         }
     }
     return(true);
 }