示例#1
0
        /// <summary>
        /// Draws the landing area.
        /// </summary>
        private void DrawLandingArea()
        {
            var drawLandingAreaName = ConsoleHelpers.ReadConsole("Enter the Landing Area Name");
            var drawLandingArea     = _landingAreaService.GetLandingAreasList()
                                      .FirstOrDefault(x => x.Description == drawLandingAreaName);

            if (drawLandingArea != null)
            {
                Console.WriteLine(_landingAreaService.GetDrawLandingArea(drawLandingArea));
            }
            else
            {
                Console.WriteLine("Not Landing Area found.");
            }
        }
示例#2
0
        /// <summary>
        /// Asks for position.
        /// </summary>
        /// <param name="landingAreaName">Name of the landing area.</param>
        /// <param name="platforName">Name of the platfor.</param>
        /// <param name="areaX">The area x.</param>
        /// <param name="areaY">The area y.</param>
        /// <returns></returns>
        public string AskForPosition(string landingAreaName, string platformName, double areaX, double areaY)
        {
            var landingArea = _landingAreaService.GetLandingAreasList()
                              .FirstOrDefault(x => x.Description == landingAreaName);

            if (landingArea == null)
            {
                return(Constants.LandingAreaNotFound);
            }

            var platform = _landingAreaService.GetPlatformsList(landingAreaName)
                           .FirstOrDefault(x => x.Description == platformName);

            if (platform == null)
            {
                return(Constants.PlatformNotFound);
            }

            var platformPositions = _positionService.GetAvailablePlatformPosition(platform);
            var positionAvailable = platformPositions.FirstOrDefault(x => x.PositionX == areaX && x.PositionY == areaY);

            if (positionAvailable == null)
            {
                return(Constants.OutOfPlatform);
            }

            if (positionAvailable.IsAvailable)
            {
                return(Constants.OkForLanding);
            }

            return(Constants.Clash);
        }