private bool IsPlayerNearby() { BoundingBox playerBox = new BoundingBox(Vector3.MaxValue, Vector3.MinValue); MyEntities.GetInflatedPlayerBoundingBox(ref playerBox, MyNeutralShipSpawner.NEUTRAL_SHIP_FORBIDDEN_RADIUS); if (playerBox.Contains(ShipController.PositionComp.GetPosition()) == ContainmentType.Contains) { return(true); } return(false); }
public override void Update() { if (ShipController == null) { return; } if ((ShipController.PositionComp.GetPosition() - m_destination).Dot(m_direction) > 0.0f) { BoundingBox playerBox = new BoundingBox(Vector3.MaxValue, Vector3.MinValue); MyEntities.GetInflatedPlayerBoundingBox(ref playerBox, MyNeutralShipSpawner.NEUTRAL_SHIP_FORBIDDEN_RADIUS); if (playerBox.Contains(ShipController.PositionComp.GetPosition()) != ContainmentType.Contains) { var shipGroup = MyCubeGridGroups.Static.Logical.GetGroup(ShipController.CubeGrid); foreach (var node in shipGroup.Nodes) { node.NodeData.SyncObject.SendCloseRequest(); } } } }
void IMyEntities.GetInflatedPlayerBoundingBox(ref VRageMath.BoundingBox playerBox, float inflation) { MyEntities.GetInflatedPlayerBoundingBox(ref playerBox, inflation); }