コード例 #1
0
ファイル: Radar.cs プロジェクト: Pycz/FightWithShadow
        /// <summary>/// Конструктор
        /// </summary>
        internal Radar(Mind mind,IAPI api)
        {
            map = new MapSector[api.getMaxX()+1,api.getMaxY()+1];		// создается поле для сканирования
            map.Initialize ();
            this.mind = mind;
            this.api = api;
            recycleSectors = new Queue<MapSector>();
            ICoordinates xy = Helper.Coordinates ( api.getMinX (),api.getMinY () );
            for (int i = api.getMinX (); i <= api.getMaxX (); i++) {
                for (int j = api.getMinY (); j <= api.getMaxY (); j++) {

                    Helper.otherPositionOfThis ( xy,i,j );
                    if (api.isNorm(xy))
                    {
                        map[i, j] = new MapSector(xy, xy, 0);
                        if (api.getTypeOfField(xy) == TypesOfField.WALL)
                        {
                            map[i, j].type = TypesOfField.WALL;
                        }
                        else
                        {
                            map[i, j].type = TypesOfField.NOTHING;
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: Radar.cs プロジェクト: Pycz/FightWithShadow
        /// <summary> создается поле, и забиваются расположения стен и всего остального
        /// </summary>
        internal Radar(Mind mind,IAPI api)
        {
            map = new Map (api.getMinX(),api.getMinY(), api.getMaxX()+1,api.getMaxY()+1);		// создается поле для сканирования

            this.mind = mind;																				// добавляются ссылки для обратного вызова
            this.api = api;

            recycleSectors = new Queue<MapSector>();

            ICoordinates xy = StepsAndCoord.Coordinates ( api.getMinX (),api.getMinY () );

            for (int i = api.getMinX (); i <= api.getMaxX (); i++) {						 // проход по карте построчно

                for (int j = api.getMinY (); j <= api.getMaxY (); j++) {

                    StepsAndCoord.otherPositionOfThis ( xy,i,j );
              if (api.isNorm(xy)) {
              map[i, j] = new MapSector();
              if (api.getTypeOfField(xy) == TypesOfField.WALL)  {
                  map[i, j].type = TypesOfField.WALL;
                                    map[i,j].xy = StepsAndCoord.Coordinates ( i,j );
              }
              else {
                                  map[i,j].xy = StepsAndCoord.Coordinates ( i,j );
                                    map[i,j].type = api.getTypeOfField ( xy );
              }
              }
                }
            }
            xFunct ();
        }
コード例 #3
0
ファイル: CState.cs プロジェクト: Pycz/FightWithShadow
        public CState(IAPI Api)
        {
            API = Api;

            MapWidthVal = API.getMaxX() - API.getMinX() + 1;
            MapHeightVal = API.getMaxY() - API.getMinY() + 1;

            Map = new CMap(MapWidthVal, MapHeightVal, API.endAfterTime());

            Map.ReadMap(API);

            MyHealth = API.myHealth();
            MyPoints = API.myPoints();

            MyCoord.Set(API.getCoordOfMe());

            PredStep.Set(Steps.STEP, MyCoord);
        }