Example #1
0
    public static Town.Town MakeTown(
        Coord index,
        int townOffsetX = 0, // WE USE THESE <---- TO DO THE SUB-TILE RENDER OFFSETS FROM TOWN INFO
        int townOffsetZ = 0,
        int seed        = 0,
        int patches     = 0)
    {
        //   Debug.Log("*** REALLY * MAKING A TOWN ***********");


        Town.TownOptions opt = new Town.TownOptions();

        // TODO. make global Tile size from Terrain
        opt.mapOffset  = new Town.Geom.Vector2(index.x * 1000, index.z * 1000);
        opt.townOffset = new Town.Geom.Vector2(townOffsetX * 1000, townOffsetZ * 1000);
        opt.Patches    = (patches == 0)? RandomGen.NextValidRandomPatchAmountFromTGOSRange() : patches;
        opt.Overlay    = TownGlobalObjectService.ProduceOverlay;
        opt.Water      = false; // ( RandomGen.Next() % 2 == 0)?true:false;
        opt.CityDetail = true;
        opt.Walls      = true;
        opt.Towers     = true;
        //   Debug.Log(opt.Patches + " patches requested");
        opt.Seed = (seed == 0) ? opt.Seed : seed;

        opt.coord = index;

        Town.Town town = new Town.Town(opt);
        // town.coord = index;
        // town.Options.coord = index;

        MeshRenderer = new TownMeshRenderer(town, opt, TownGlobalObjectService.rendererOptions);

        TownGlobalObject.TownsWaitingToRender.Enqueue(MeshRenderer);

        TownGlobalObject.TownWaitingToRender = true;


        //Debug.LogFormat("{0} is {1} for location with {2} of {3} and {4} of {5} for {6} of size {7} ",
        //    nameof(index),
        //    index,
        //    nameof(opt.mapOffset),
        //    opt.mapOffset,
        //    nameof(opt.townOffset),
        //    opt.townOffset,
        //    town.name,
        //    opt.Patches
        //    );



        return(town);
    }