예제 #1
0
        /// <summary>
        ///  To Fire the Missile on the cell of the ship and return the status
        /// </summary>
        /// <param name="X_"></param>
        /// <param name="Y_"></param>
        /// <returns></returns>
        public bool IsFireSuccess(char X_, int Y_)
        {
            ICell _cell = lstCells.Where(x => x.status.Equals(StatusType.F) && x.position.X.Equals(X_) && x.position.Y.Equals(Y_)).FirstOrDefault();

            if (_cell != null)
            {
                _cell.HitCount = _cell.HitCount + 1;
                if (ShipType.Equals(ShipsType.P))
                {
                    _cell.status = StatusType.D;
                }
                else if (_cell.HitCount > 1)
                {
                    _cell.status = StatusType.D;
                }
                return(true);
            }

            return(false);
        }