public override void Close() { Debug.Assert(!m_isClosed); m_sensor.MarkForClose(); SetOff(false); //ClearDetectedEntities(false); //RemoveSensor(); //m_isOn = false; m_detectionCriterias.Clear(); m_sensor = null; OnEntityEnter = null; OnEntityLeave = null; OnEntityPositionChange = null; base.Close(); m_isClosed = true; }
public override void Close() { MyGuiScreenGamePlay.OnGameLoaded -= m_onGameLoaded; if (m_sensor != null) { //m_sensor.GetElement().ProxyData = MyElement.PROXY_UNASSIGNED; m_sensor.MarkForClose(); MyPhysics.physicsSystem.GetSensorModule().RemoveSensor(m_sensor); m_sensor = null; } foreach (var part in Parts) { if (part != null && part.EntityId.HasValue) { MyEntities.Remove(part); } } base.Close(); }