public static GetBoundingBox ( IMyCubeGrid entity ) : OrientedBoundingBoxD | ||
entity | IMyCubeGrid | |
return | OrientedBoundingBoxD |
/* * static public Boolean CheckCoolDown(String name, out int timeLeft) * { * timeLeft = 0; * DockingCooldownItem item = null; * var list = PluginDocking.CooldownList.FindAll(n => n.name.ToLower() == name.ToLower()); // Change to FirstOrDefault * foreach (DockingCooldownItem i in list) * { * item = i; * break; * } * * if (item != null) * { * timeLeft = (int)(20.0 - (DateTime.Now - item.startTime).TotalSeconds); * if (timeLeft <= 0) * { * PluginDocking.CooldownList.Remove(item); * item = null; * } * } * * return item != null; * } */ static public bool CheckForIntersection(Dictionary <String, List <IMyCubeBlock> > testList, List <IMyCubeBlock> beaconList, out int intersectElement) { Boolean intersects = false; intersectElement = 0; OrientedBoundingBoxD targetTestBounding = Entity.GetBoundingBox(beaconList); if (testList.Count > 0) { for (int r = 0; r < testList.Count; r++) { List <IMyCubeBlock> beaconTestList = (List <IMyCubeBlock>)testList.ElementAt(r).Value; if (beaconTestList.Count != 4) { continue; } OrientedBoundingBoxD testBounding = Entity.GetBoundingBox(beaconTestList); if (testBounding.Contains(ref targetTestBounding) != ContainmentType.Disjoint) { intersectElement = r; intersects = true; break; } } } return(intersects); }
public static bool IsGridInside(IMyCubeGrid dockingEntity, List <IMyCubeBlock> beaconList) { // Get bounding box of both the docking zone and docking ship OrientedBoundingBoxD targetBounding = Entity.GetBoundingBox(beaconList); OrientedBoundingBoxD dockingBounding = Entity.GetBoundingBox(dockingEntity); // If the docking entity is bigger in some way than the zone, this will fail (docking ship larger than dock) ??? if (!Entity.GreaterThan(dockingBounding.HalfExtent * 2, targetBounding.HalfExtent * 2)) { return(false); } // Make sure the docking zone contains the docking ship. If they intersect or are disjointed, then fail if (targetBounding.Contains(ref dockingBounding) != ContainmentType.Contains) { return(false); } return(true); }