public void DestroyDataPoint(GameObject record) { if (!Records.Contains(record)) { Debug.Log("Record not found"); return; } _records.Remove(record); // destroy any cluster links NodePhysX recordScript = record.GetComponent <NodePhysX>(); recordScript.DestroyCentroidLinks(); recordScript.DestroyAssociationLinks(); recordScript.DestroyGeneLinks(); // destroy the record UnityEngine.Object.Destroy(record); }
public void DestroyDataPoint(int index) { if (index >= Count) { Debug.Log("index greater than records count"); return; } GameObject removeRecord = _records[index]; _records.RemoveAt(index); // destroy any cluster links NodePhysX recordScript = removeRecord.GetComponent <NodePhysX>(); recordScript.DestroyCentroidLinks(); recordScript.DestroyAssociationLinks(); recordScript.DestroyGeneLinks(); // destroy the record UnityEngine.Object.Destroy(removeRecord); }
public bool DestroyLastDataPoint() { if (_records.Count == 0) { return(false); } GameObject removeRecord = _records[Count - 1]; _records.RemoveAt(Count - 1); // destroy any cluster links NodePhysX recordScript = removeRecord.GetComponent <NodePhysX>(); recordScript.DestroyCentroidLinks(); recordScript.DestroyAssociationLinks(); recordScript.DestroyGeneLinks(); // destroy the record UnityEngine.Object.Destroy(removeRecord); return(true); }