/// <summary> /// Loads descriptor of the sensor and initialize the sensor /// </summary> public bool LoadFromDesc(MySensorDesc desc) { if (m_Inserted) { return false; } if(!desc.IsValid()) return false; m_Matrix = desc.m_Matrix; m_Element = desc.m_Element; m_Element.Sensor = this; m_SensorEventHandler = desc.m_SensorEventHandler; MyCommonDebugUtils.AssertDebug(m_Interactions.Count == 0); m_Interactions.Clear(); m_Guid = GUID_COUNTER; if (GUID_COUNTER > ushort.MaxValue) { GUID_COUNTER = 0; } GUID_COUNTER++; return true; }
/// <summary> /// Loads descriptor of the sensor and initialize the sensor /// </summary> public bool LoadFromDesc(MySensorDesc desc) { if (m_Inserted) { return(false); } if (!desc.IsValid()) { return(false); } m_Matrix = desc.m_Matrix; m_Element = desc.m_Element; m_Element.Sensor = this; m_SensorEventHandler = desc.m_SensorEventHandler; MyCommonDebugUtils.AssertDebug(m_Interactions.Count == 0); m_Interactions.Clear(); m_Guid = GUID_COUNTER; if (GUID_COUNTER > ushort.MaxValue) { GUID_COUNTER = 0; } GUID_COUNTER++; return(true); }
public void Close() { MyCommonDebugUtils.AssertDebug(m_isMarkedForClose); MyCommonDebugUtils.AssertDebug(m_Interactions.Count == 0); if (m_Element != null) { m_Element.Close(); m_Element = null; } m_SensorEventHandler = null; m_Interactions.Clear(); m_Interactions = null; m_UserData = null; }
public MySensor() { m_UserData = null; m_Element = null; m_SensorEventHandler = null; m_Matrix = new Matrix(); m_Inserted = false; m_isMarkedForClose = false; m_Interactions = new Dictionary <int, MySensorInteraction>(32); m_Guid = GUID_COUNTER; if (GUID_COUNTER == ushort.MaxValue) { GUID_COUNTER = 0; } GUID_COUNTER++; }
public MySensor() { m_UserData = null; m_Element = null; m_SensorEventHandler = null; m_Matrix = new Matrix(); m_Inserted = false; m_isMarkedForClose = false; m_Interactions = new Dictionary<int, MySensorInteraction>(32); m_Guid = GUID_COUNTER; if (GUID_COUNTER == ushort.MaxValue) { GUID_COUNTER = 0; } GUID_COUNTER++; }
/// <summary> /// default settings /// </summary> public void SetToDefault() { m_Matrix = Matrix.Identity; m_SensorEventHandler = null; }
public MySensorDesc() { m_Matrix = Matrix.Identity; m_SensorEventHandler = null; m_Element = null; }