public void Sink() { List <SeaCell> cells; lock (Cells) { cells = Cells.ToList(); } foreach (var cell in cells) { cell.SetState(SeaCellState.SHIP_SUNK); } OnShipSunk?.Invoke(this); }
//private void Ship_OnCellStateChanged(SeaCell cell) //{ // OnShipCellStateChanged?.Invoke(cell.Ship, cell); //} private void Ship_OnShipSunk(Ship ship) { OnShipSunk?.Invoke(ship); }