public static ShotResult CreateMisfire(string reason) { var result = new ShotResult(false, false) { MisfireReason = reason }; return(result); }
public static ShotResult CreateHit(IShip ship, bool reportSunkenShip = false) { var result = new ShotResult(true, true); if (ship.HasSunk && reportSunkenShip) { result.SunkenShip = ship; } return(result); }
public void ProcessShotResult(Coordinates coords, ShotResult result) { var field = EnemyBoard.Fields.At(coords.Row, coords.Column); switch (result) { case ShotResult.Hit: field.FieldType = FieldType.Hit; break; case ShotResult.Sunk: field.FieldType = FieldType.Hit; break; default: field.FieldType = FieldType.Miss; break; } }