private void SpawnHouseInLevel()
    {
        levelController       = GameObject.Find("LevelController") as GameObject;
        levelControllerScript = levelController.GetComponent <LevelControllerScript>();

        Debug.Log(mapRows);
        int houseWidth  = Random.Range(10, 15);
        int houseHeight = Random.Range(10, 15);

        int plotTopLeftCornerX = Random.Range(0, mapCols - (houseWidth + 1));
        int plotTopLeftCornerY = Random.Range(0 + houseHeight, mapRows);

        int orientation = Random.Range(0, 4);

        int enterWidth  = Random.Range(3, 5);
        int enterHeight = Random.Range(3, 5);

        for (int i = 0; i < 100; ++i)
        {
            levelControllerScript.ReplaceTile(Random.Range(0, mapCols), Random.Range(0, mapRows), woodTile);
        }
        for (int i = 0; i < 100; ++i)
        {
            levelControllerScript.SpawnItem(Random.Range(0, mapCols), Random.Range(0, mapRows), item);
        }

        levelControllerScript.ReplaceTile(5, 5, woodTile);
    }
    // Use this for initialization
    void Start()
    {
        woodTile = Resources.Load("Prefabs/Environment/WoodWall") as GameObject;
        item     = Resources.Load("Prefabs/Items/Item") as GameObject;

        levelController       = GameObject.Find("LevelController") as GameObject;
        levelControllerScript = levelController.GetComponent <LevelControllerScript>();
        mapRows = levelControllerScript.GetMapRows();
        mapCols = levelControllerScript.GetMapCols();
        levelControllerScript.ReplaceTile(0, 0, woodTile);
        GenerateLevel();
    }
Пример #3
0
 public void ShowDungeon()
 {
     for (int y = 0; y < this._ysize; y++)
     {
         for (int x = 0; x < this._xsize; x++)
         {
             // Console.Write(GetCellTile(x, y));
             levelControllerScript.ReplaceTile(x, y, GetCellType(x,y));
         }
         //bandaid
         //if (this._xsize <= xmax) { levelControllerScript.ReplaceTile(x, y, wallTile); }
     }
 }
    void print()
    {
        for (int y = 0; y < _height; ++y)
        {
            for (int x = 0; x < _width; ++x)
            {
                //replace the tile with getTile(x, y)
                switch (getTile(x, y))
                {
                case Tile.Corridor:
                    levelControllerScript.ReplaceTile(x, y, corridor);
                    break;

                case Tile.Floor:
                    levelControllerScript.ReplaceTile(x, y, floor);
                    break;

                case Tile.Door:
                    levelControllerScript.ReplaceTile(x, y, door);
                    break;

                case Tile.Wall:
                    levelControllerScript.ReplaceTile(x, y, wall);
                    break;

                case Tile.Unused:
                    levelControllerScript.ReplaceTile(x, y, unused);
                    break;

                default:
                    levelControllerScript.ReplaceTile(x, y, unused);
                    break;
                }
            }
        }
    }