コード例 #1
0
ファイル: TurnService.cs プロジェクト: DmytroHavryliak96/ZOO
        public SightDirection getSightDirectionLeft(SightDirection direction)
        {
            var leftDirection = direction;

            switch (direction)
            {
            case SightDirection.North:
            {
                leftDirection = SightDirection.West;
                break;
            }

            case SightDirection.South:
            {
                leftDirection = SightDirection.East;
                break;
            }

            case SightDirection.East:
            {
                leftDirection = SightDirection.North;
                break;
            }

            case SightDirection.West:
            {
                leftDirection = SightDirection.South;
                break;
            }

            default:
                break;
            }
            return(leftDirection);
        }
コード例 #2
0
        public LocationService getLocationService(Point currentPoint, SightDirection direct)
        {
            ILocationService sightService = getLocationServiceSight(direct);
            LocationService  service      = new LocationService(currentPoint, direct, sightService);

            return(service);
        }
コード例 #3
0
        private ILocationService getLocationServiceSight(SightDirection Direction)
        {
            int worldSize = Convert.ToInt32(Settings.Default.WorldSize);
            ILocationService service;

            switch (Direction)
            {
            case SightDirection.North:
            {
                service = new LocationNorth(worldSize);
                break;
            }

            case SightDirection.South:
            {
                service = new LocationSouth(worldSize);
                break;
            }

            case SightDirection.East:
            {
                service = new LocationEast(worldSize);
                break;
            }

            case SightDirection.West:
            {
                service = new LocationWest(worldSize);
                break;
            }

            default:
            {
                service = new LocationNorth(worldSize);
                break;
            }
            }
            return(service);
        }
コード例 #4
0
 public LocationService(Point p, SightDirection direct, ILocationService locationService)
 {
     BasePoint            = p;
     Direction            = direct;
     this.locationService = locationService;
 }