public Task Handle(ShipHit message) { _gameDisplay.DisplayHit(message.ShipName); _store.AddHit(message.Target.X, message.Target.Y); _gameDisplay.DisplayBoard(_store.ShotsTaken, _store.BoardSize); return(Task.CompletedTask); }
private void Apply(ShipHit e) { this._shotsTaken.Add(e.Target); var shipId = _board.GetObjectIdOnBoard(e.Target.X, e.Target.Y); _ships[shipId.Value].Shoot(); }
private void CheckShot(int rowIndex, int columnIndex) { var ship = GetShipByGridPoint(rowIndex, columnIndex); if (ship.IsDead) { ShipSunk?.Invoke(this, ship); } else { ShipHit?.Invoke(this, ship); } }