static bool CheckDoors(Vector3 v1, Vector3 v2, Bounds[] doors) { foreach (Bounds d in doors) { Interval x = new Interval(d.min.x, d.max.x); Interval y = new Interval(d.min.y, d.max.y); Interval z = new Interval(d.min.z, d.max.z); if (x.ContainsInclusive(v1.x) && y.ContainsInclusive(v1.y) && z.ContainsInclusive(v1.z) && x.ContainsInclusive(v2.x) && y.ContainsInclusive(v2.y) && z.ContainsInclusive(v2.z)) { return(true); } } return(false); }
static bool CheckDoors(Vector3 v1, Vector3 v2, Bounds[] doors) { foreach(Bounds d in doors) { Interval x = new Interval(d.min.x, d.max.x); Interval y = new Interval(d.min.y, d.max.y); Interval z = new Interval(d.min.z, d.max.z); if(x.ContainsInclusive(v1.x) && y.ContainsInclusive(v1.y) && z.ContainsInclusive(v1.z) && x.ContainsInclusive(v2.x) && y.ContainsInclusive(v2.y) && z.ContainsInclusive(v2.z)) return true; } return false; }