예제 #1
0
        private void updateTilemapUsingWallmap(Tilemap p_tilemap, Tilemap p_wallMap,
			Tilemap p_roadMap, WallMapper p_wallMapper)
        {
            for (int y = 0; y < p_wallMap.getRows(); y++)
            {
                for (int x = 0; x < p_wallMap.getColumns(); x++)
                {
                    if (p_wallMap.getState(x, y) >= 0)
                    {
                        p_tilemap.setState(x, y, p_wallMapper.getContactType(x, y, p_roadMap));
                    }
                }
            }
        }
예제 #2
0
 private void updateTilemapUsingRoadmap(Tilemap p_tilemap, Tilemap p_roadMap, RoadMapper p_roadMapper)
 {
     for (int y = 0; y < p_roadMap.getRows(); y++)
     {
         for (int x = 0; x < p_roadMap.getColumns(); x++)
         {
             if (p_roadMap.getState(x, y) >= 0)
             {
                 p_tilemap.setState(x, y, p_roadMapper.getContactType(x, y, p_roadMap));
             }
             else if (p_roadMap.getState(x, y) == -1)
             {
                 p_tilemap.setState(x, y, 31);
             }
         }
     }
 }
예제 #3
0
 private void updateTilemapUsingSingles(Tilemap p_mainTilemap, Tilemap p_singlesTilemap)
 {
     for (int y = 0; y < p_mainTilemap.getRows(); y++)
     {
         for (int x = 0; x < p_mainTilemap.getColumns(); x++)
         {
             if (p_singlesTilemap.getState(x, y) >= 0)
             {
                 p_mainTilemap.setState(x, y, p_singlesTilemap.getState(x, y));
             }
         }
     }
 }
예제 #4
0
 private void generateWallmapFromRoadmap(Tilemap p_wallMap, Tilemap p_roadMap)
 {
     p_wallMap.clear();
     // Sweep adding walls
     for (int y = 0; y < p_roadMap.getRows(); y++)
     {
         for (int x = 0; x < p_roadMap.getColumns(); x++)
         {
             if (p_roadMap.getState(x, y) >= 0)
             {
                 p_wallMap.setState(x - 1, y - 1, 1);
                 p_wallMap.setState(x, y - 1, 1);
                 p_wallMap.setState(x + 1, y - 1, 1);
                 p_wallMap.setState(x + 1, y, 1);
                 p_wallMap.setState(x + 1, y + 1, 1);
                 p_wallMap.setState(x, y + 1, 1);
                 p_wallMap.setState(x - 1, y + 1, 1);
                 p_wallMap.setState(x - 1, y, 1);
             }
         }
     }
     // Sweep removing on roads
     for (int y = 0; y < p_roadMap.getRows(); y++)
     {
         for (int x = 0; x < p_roadMap.getColumns(); x++)
         {
             if (p_roadMap.getState(x, y) >= 0)
             {
                 p_wallMap.setState(x, y, -1);
             }
         }
     }
 }