コード例 #1
0
    private void BuildFromTilemap()
    {
        string containerPath = "Tilemap/";      //we might also have several themes which can be put in seperate folders

        float startX = 0;
        float startY = 0;

        for (int i = 0; i < rows; i++)
        {
            for (int j = 0; j < columns; j++)
            {
                if (tileGrid[i][j] == null)
                {
                    continue;
                }
                Tile tile = tileGrid[i][j];
                tile.x = startX + j * TileLength;
                tile.y = startY + i * TileLength;
                //load Floor prefab
                string     floorPath   = containerPath + "Floor/" + Floor.StringFor(tile.floor.type);
                GameObject floorObject = Instantiate(Resources.Load(floorPath, typeof(GameObject))) as GameObject;
                floorObject.transform.position = new Vector3(tile.x, 0, tile.y);
                floorObject.transform.Rotate(0, AngleFor(tile.floor.direction), 0, Space.Self);

                //load Ceiling prefab
                string     ceilingPath   = containerPath + "Ceiling/" + Ceiling.StringFor(tile.ceiling.type);
                GameObject ceilingObject = Instantiate(Resources.Load(ceilingPath, typeof(GameObject))) as GameObject;
                ceilingObject.transform.position = new Vector3(tile.x, 0, tile.y);
                ceilingObject.transform.Rotate(0, AngleFor(tile.ceiling.direction), 0);
            }
        }

        //make image containers by looking for continious walls and doors
        List <ImageContainer> imageContainerList = MakeImageContainers();

        //go throught each image container and make a prefab at those positions
        PlacePhotosIn(imageContainerList);
    }
コード例 #2
0
 override public string ToString()
 {
     return(Ceiling.StringFor(type) + "-" + Tilemap.AngleFor(direction));
 }