private void CleanupFish(Fish f) { _collected.Enqueue(f.gameObject); if (_collected.Count > MaxFish) { // Too many fish, kill the oldest Destroy(_collected.Dequeue()); } }
/// <summary> /// Drop a fish into the collector. /// </summary> /// <param name="f">Fish that was dropped</param> public void DropFish(Fish f) { f.Release(DropPoint); CleanupFish(f); }