public static bool ApplyTerrainChecks(this Transform transform, TerrainCheck[] anchors, Vector3 pos, Quaternion rot, Vector3 scale, SpawnFilter filter = null) { if (anchors.Length == 0) { return(true); } for (int i = 0; i < (int)anchors.Length; i++) { TerrainCheck terrainCheck = anchors[i]; Vector3 vector3 = Vector3.Scale(terrainCheck.worldPosition, scale); if (terrainCheck.Rotate) { vector3 = rot * vector3; } Vector3 vector31 = pos + vector3; if (TerrainMeta.OutOfBounds(vector31)) { return(false); } if (filter != null && filter.GetFactor(vector31) == 0f) { return(false); } if (!terrainCheck.Check(vector31)) { return(false); } } return(true); }
public static bool ApplyTerrainChecks( this Transform transform, TerrainCheck[] anchors, Vector3 pos, Quaternion rot, Vector3 scale, SpawnFilter filter = null) { if (anchors.Length == 0) { return(true); } for (int index = 0; index < anchors.Length; ++index) { TerrainCheck anchor = anchors[index]; Vector3 vector3_1 = Vector3.Scale(anchor.worldPosition, scale); if (anchor.Rotate) { vector3_1 = Quaternion.op_Multiply(rot, vector3_1); } Vector3 vector3_2 = Vector3.op_Addition(pos, vector3_1); if (TerrainMeta.OutOfBounds(vector3_2) || filter != null && (double)filter.GetFactor(vector3_2) == 0.0 || !anchor.Check(vector3_2)) { return(false); } } return(true); }
void Start() { tcheck = gameObject.GetComponent <TerrainCheck>(); }