void DestroyCell(Vector3Int cellId) { if (_cellObjects.TryGetValue(cellId, out InRangeCellInfo cellInfo)) { _loadBalancer.CancelTask(cellInfo.ObjectsCreationCoroutine); Object.Destroy(cellInfo.GameObject); _cellObjects.Remove(cellId); } else { Utils.Error("Tried to destroy a cell that isn't created."); } }
private void DestroyExteriorCell(Vector2i indices) { InRangeCellInfo cellInfo; if (cellObjects.TryGetValue(indices, out cellInfo)) { temporalLoadBalancer.CancelTask(cellInfo.creationCoroutine); GameObject.Destroy(cellInfo.gameObject); cellObjects.Remove(indices); } else { Debug.LogError("Tried to destroy a cell that isn't created."); } }