示例#1
0
    //TODO: Add item spawn generation, add player, and saving the map for later sharing.
    //Generates the sectors based off of the generation requirements and instantiates them

    /**
     * Picks the land type based off random value in the terrain seed.
     */
    private void GenerateLevel(GenHeader.Decisions decisions)
    {
        //Set spawn position
        //TODO: Build sectors at terrain location
        centerSectorX = 0;
        centerSectorY = 20;
        centerSectorZ = 0;

        if (decisions.renderStructure)
        {
            ChooseStructure();
        }


        if (decisions.renderTerrain)
        {
            int land = ChooseTerrain();
            Debug.Log(land);
        }
    }
示例#2
0
    // Use this for initialization
    public Generation(Transform[] halls, Transform[] rooms, Material[] materials,
                      Transform[] water, Transform[] walls, Transform[] barriers,
                      Transform[] decorations, int sectorX, int sectorY)
    {
        //Copy halls over
        this.halls = new Transform[halls.Length];
        for (int x = 0; x < halls.Length; x++)
        {
            this.halls[x] = halls[x];
        }
        //Copy rooms over
        this.rooms = new Transform[rooms.Length];
        for (int x = 0; x < rooms.Length; x++)
        {
            this.rooms[x] = rooms[x];
        }
        //Copy terrain over
        this.materials = new Material[materials.Length];
        for (int x = 0; x < materials.Length; x++)
        {
            this.materials[x] = materials[x];
        }
        //Copy water over
        this.water = new Transform[water.Length];
        for (int x = 0; x < water.Length; x++)
        {
            this.water[x] = water[x];
        }

        /*//Copy walls over
         * this.walls = new Transform[walls.Length];
         * for (int x = 0; x < walls.Length; x++) {
         *      this.walls[x] = walls[x];
         * }
         * //Copy barriers over
         * this.barriers = new Transform[barriers.Length];
         * for (int x = 0; x < barriers.Length; x++) {
         *      this.barriers[x] = barriers[x];
         * }
         * //Copy decorations over
         * this.decorations = new Transform[decorations.Length];
         * for (int x = 0; x < decorations.Length; x++) {
         *      this.decorations[x] = decorations[x];
         * }*/

        //Initialize map creation settings
        GenHeader.Decisions decisions = new GenHeader.Decisions {
            renderStructure = RandomBool(),
            renderWater     = RandomBool(),
            renderWall      = RandomBool()
        };

        //Terrain can have the chance of gen if rooms and halls are made
        if (decisions.renderStructure)
        {
            decisions.renderTerrain = RandomBool();
        }
        //When no halls or roomms are being made, terrainn is needed.
        else
        {
            decisions.renderTerrain = true;
        }

        //Generate level
        GenerateLevel(decisions);
    }