Beispiel #1
0
 public Tuple<bool, bool, Ship> Hit(BoardPosition position)
 {
     return Hit(position.X, position.Y);
 }
Beispiel #2
0
        public Tuple<bool, bool, Ship> Hit(int x, int y)
        {
            var position = new BoardPosition(x, y);

            foreach (var wrapper in shipWrappers)
            {
                if(wrapper.Ship.IsSunk) { continue; }

                if (!wrapper.Positions.Contains(position)) { continue; }

                return new Tuple<bool, bool, Ship>(true, wrapper.Hit(position), wrapper.Ship);
            }

            return new Tuple<bool, bool, Ship>(false, false, null);
        }
Beispiel #3
0
        Button hpButton(BoardPosition position)
        {
            foreach (var control in Controls)
            {
                if (control is Button)
                {
                    var button = control as Button;
                    if (button.Name == hp_btn_Name(position.X, position.Y))
                    {
                        return button;
                    }
                }
            }

            return null;
        }