Exemplo n.º 1
0
 // read tiles zoning property given current location
 Tileset ZoningProperty(MapDataTemplate mapData, int x, int y)
 {
     if (mapData.building_xFrom <= x && x <= mapData.building_xTo && mapData.building_yFrom <= y && y <= mapData.building_yTo) // if x and y is within zoning property of garden
     {
         // this tile should be building
         return Tileset.Building;
     }
     if (mapData.garden_xFrom <= x && x <= mapData.garden_xTo && mapData.garden_yFrom <= y && y <= mapData.garden_yTo) // if x and y is within zoning property of garden
     {
         // this tile should be garden
         return Tileset.Garden;
     }
     Debug.Log("Error may have occurred - check ZoningProperty under MapManager");
     return Tileset.Default;
 }
Exemplo n.º 2
0
    // given the MapDataTemplate, lay down all premade GameObjects
    void PlacePremadeTiles(MapDataTemplate mapData)
    {
        // Place premade 3x3
        int xOffSet = mapData.premade3x3OriginX;
        int yOffSet = mapData.premade3x3OriginY;

        PlaceGameObjectAddToList(mapData.tile3x3_0_0, 0 + xOffSet, 0 + yOffSet);
        PlaceGameObjectAddToList(mapData.tile3x3_0_1, 0 + xOffSet, 1 + yOffSet);
        PlaceGameObjectAddToList(mapData.tile3x3_0_2, 0 + xOffSet, 2 + yOffSet);

        PlaceGameObjectAddToList(mapData.tile3x3_1_0, 1 + xOffSet, 0 + yOffSet);
        PlaceGameObjectAddToList(mapData.tile3x3_1_1, 1 + xOffSet, 1 + yOffSet);
        PlaceGameObjectAddToList(mapData.tile3x3_1_2, 1 + xOffSet, 2 + yOffSet);

        PlaceGameObjectAddToList(mapData.tile3x3_2_0, 2 + xOffSet, 0 + yOffSet);
        PlaceGameObjectAddToList(mapData.tile3x3_2_1, 2 + xOffSet, 1 + yOffSet);
        PlaceGameObjectAddToList(mapData.tile3x3_2_2, 2 + xOffSet, 2 + yOffSet);
    }