public Robot() { lock (Lock) { int nextIndex = GetAvailableIndex(); if (nextIndex == -1) { nextIndex = UsedCounter.Count; UsedCounter.Add(true); } ID = nextIndex; } }