예제 #1
0
    public static Baracks GenerateBaracks(Baracks building, BuildingStyle style = BuildingStyle.stone)
    {
        int width  = building.Width;
        int height = building.Height;

        Vec2i entr = GenerateWallsFloorAndEntrance(width, height, building.BuildingObjects, building.BuildingTiles, 0, style, tileType: Tile.TEST_PURPLE);

        building.SetEntrancePoint(entr);
        List <NPCJob> jobs = new List <NPCJob>();

        for (int x = 2; x < building.Width; x += 3)
        {
            AddObject(building, new Bed(new Vec2i(2, 2)), x, 2);
            jobs.Add(new NPCJobSoldier(building));
        }
        NPCJob[] jobs_ = jobs.ToArray();
        building.SetWorkBuildingData(new WorkBuildingData(jobs_));

        return(building);
    }
예제 #2
0
    /// <summary>
    /// Takes a building plan and generates a full building from it.
    /// TODO - Currently messy, fix
    /// </summary>
    /// <param name="plan"></param>
    /// <param name="width"></param>
    /// <param name="height"></param>
    /// <param name="entrance"></param>
    /// <returns></returns>
    public static Building CreateBuilding(BuildingPlan plan, int width = -1, int height = -1, int entrance = 0)
    {
        if (width == -1)
        {
            width = MiscMaths.RandomRange(plan.MinSize, plan.MaxSize);
        }
        else if (width < plan.MinSize)
        {
            width = plan.MinSize;
        }
        else if (width > plan.MaxSize)
        {
            width = plan.MaxSize;
        }

        if (height == -1)
        {
            height = MiscMaths.RandomRange(plan.MinSize, plan.MaxSize);
        }
        else if (height < plan.MinSize)
        {
            height = plan.MinSize;
        }
        else if (height > plan.MaxSize)
        {
            height = plan.MaxSize;
        }

        Tile[,] buildingBase = new Tile[width, height];
        WorldObjectData[,] buildingObjects = new WorldObjectData[width, height];

        if (plan == Building.HOUSE)
        {
            House h = new House(width, height);
            h.SetBuilding(buildingBase, buildingObjects);
            return(GenerateHouse(h, BuildingStyle.stone));
        }
        if (plan == Building.BLACKSMITH)
        {
            Blacksmith b = new Blacksmith(width, height);
            b.SetBuilding(buildingBase, buildingObjects);
            return(GenerateBlacksmith(b, BuildingStyle.stone));
        }
        if (plan == Building.MARKET)
        {
            MarketPlace market = new MarketPlace(width, height);
            market.SetBuilding(buildingBase, buildingObjects);
            return(GenerateMarket(market, BuildingStyle.stone));
        }
        if (plan == Building.BARACKS)
        {
            Baracks baracks = new Baracks(width, height);
            baracks.SetBuilding(buildingBase, buildingObjects);
            return(GenerateBaracks(baracks));
        }

        /*
         * if(plan == Building.MARKET)
         * {
         *  MarketPlace market = new MarketPlace(width, height);
         *  market.SetBuilding(buildingBase, buildingObjects);
         *  return GenerateMarket(market, BuildingStyle.stone);
         * }
         * if(plan == Building.BARACKSCITY)
         * {
         *  Baracks bar = new Baracks(width, height);
         *  bar.SetBuilding(buildingBase, buildingObjects);
         *  return GenerateCityBaracks(bar);
         * }
         * if (plan == Building.BARACKSCITY || plan == Building.BARACKSTOWN)
         * {
         *
         * }*/

        //Default for now
        House ht = new House(width, height);

        ht.SetBuilding(buildingBase, buildingObjects);
        return(GenerateHouse(ht, BuildingStyle.stone));
    }