public void AddToWatchList(SG_DeviceLink link) { if (ListIndex(link) < 0) //using listIndex since we might use that function later on { this.devicesToLink.Add(link); } }
/// <summary> </summary> /// <param name="link"></param> /// <remarks> Using Index as opposed to bool because it might be useful later on </remarks> /// <returns></returns> public int ListIndex(SG_DeviceLink link) { for (int i = 0; i < devicesToLink.Count; i++) { if (GameObject.ReferenceEquals(link, devicesToLink[i])) { return(i); } } return(-1); }