public override Boolean Equals(Object point) { if (null == point || !(point is HitPoint)) { return(false); } HitPoint OtherPoint = point as HitPoint; return(OtherPoint.Location.Equals(Location)); }
public Boolean IsHit(Point point) { if (null == Points) { throw new Exception("Boat is not setup."); } HitPoint HitPoint = Points.FirstOrDefault((aPoint) => { return(aPoint.Location.X == point.X && aPoint.Location.Y == point.Y); }); if (HitPoint != null) { if (HitPoint.Hit) { throw new Exception("Point was already hit."); } HitPoint.Hit = true; return(true); } return(false); }