public bool Purchase (Economy e) { if (CanPurchase(e)) { currentEconomy.purchase(e); return true; } else { return false; } }
// Use this for initialization void Start () { sharedState = this; Config c = new Config(); // starting economy currentEconomy = new Economy(c.initialEconomy); // factories to start with factories = new System.Collections.Generic.Stack<Factory>(); }
private void loadDisplayer() { if (_displayer == null) { _displayer = GameObject.Find("_SceneManager").GetComponent <DisplayerRocketLevel>(); } if (_economy == null) { _economy = GameObject.Find("_EconomicMechanism").GetComponent <Economy>(); } }
public override void ViewRender() { base.ViewRender(); var company = SelectedCompany; Income.text = "$" + Format.Minify(Economy.GetIncome(Q, company)); IncomeHint.SetHint(GetIncomeDescription(Q, company)); Maintenance.text = "$" + Format.Minify(Economy.GetMaintenance(Q, company)); MaintenanceHint.SetHint(GetMaintenanceDescription(Q, company)); }
void Update() { if (!this.isRunning) { return; } if (econClone == null) { if (GameObject.Find("Economy(Clone)") != null) { econClone = GameObject.Find("Economy(Clone)").GetComponent <Economy>(); } else { return; } } RefreshRolelessUI(); ReceiveRunnerStates(); ReceiveBlockUpdates(); ReceiveGameStates(); ReceiveClockStates(); ReceiveProjtilePacket(); ReceivePushPacket(); switch (myTeamRole) { case TeamRole.PurpleRunner: SendRunnerState(); break; case TeamRole.YellowRunner: SendRunnerState(); break; default: break; } if (scoreboard.mPacket.IsGameOver) { GameOver(); } //Ignore. Game over testing. if (Input.GetKeyDown(KeyCode.F1) && playersInfo.IsHosts[(int)myTeamRole]) { Debug.Log("F1 key pressed down. Game over testing triggered."); scoreboard.mPacket.IsGameOver = true; scoreboard.mPacketDirtyBit = true; GameOver(); } }
public PayoffParser(Economy e, string s) { var cc = new CounterCollection(); var eco = e; NodeOps = new NodeOperation[] { new Add(), new Subtract(), new Multiply(), new Divide(), new Power(), new Sqrt(), new Exp(), new Log(), new Ln(), new Abs(), new Max(), new Max(cc), new Min(), new Min(cc), new Int(), new Pos(), new Rate(eco), new ATM(eco), new SwapRate(eco), new Discount(eco), new PV(eco), new Sum(), new Sum(cc), new Counter(cc) }; // Warning: The order of the first 5 cannot be changed! MasterNode = new Node(s, NodeOps); }
public Result <Economy> GetEconomy(string html) { var blockPop = _scrapParser .ScrapBlockPage(html, "colspan=\"2\">População</th>", "colspan=\"2\">Trabalho e Rendimento</th>"); var tablesPop = blockPop.SplitString("<tr _ngcontent-c2017="); var economy = new Economy(); try { if (!string.IsNullOrEmpty(tablesPop[1]?.ToString())) { economy.PIB = _scrapParser .ScrapBlockPage(tablesPop[1], "class=\"lista__valor\" colspan=\"2\">", "<span _ngcontent")?.Trim(); } if (!string.IsNullOrEmpty(tablesPop[3]?.ToString())) { economy.PercRevFontExt = _scrapParser .ScrapBlockPage(tablesPop[3], "class=\"lista__valor\" colspan=\"2\">", "<span _ngcontent")?.Trim(); } if (!string.IsNullOrEmpty(tablesPop[5]?.ToString())) { economy.IndDesenHumWor = _scrapParser .ScrapBlockPage(tablesPop[5], "class=\"lista__valor\" colspan=\"2\">", "<span _ngcontent")?.Trim(); } if (!string.IsNullOrEmpty(tablesPop[7]?.ToString())) { economy.AmountRecFulfilled = _scrapParser .ScrapBlockPage(tablesPop[7], "class=\"lista__valor\" colspan=\"2\">", "<span _ngcontent")?.Trim(); } if (!string.IsNullOrEmpty(tablesPop[9]?.ToString())) { economy.AmountComExp = _scrapParser .ScrapBlockPage(tablesPop[9], "class=\"lista__valor\" colspan=\"2\">", "<span _ngcontent")?.Trim(); } } catch (Exception ex) { return(new Result <Economy>(ResultCode.Error, ex.Message)); } return(new Result <Economy>(ResultCode.OK, economy)); }
public override void ViewRender() { base.ViewRender(); var industry = MyCompany.companyFocus.Industries[0]; // get independent companies, that are interested in this industry var companies = Companies.GetNonFundCompaniesInterestedInIndustry(Q, industry) .OrderByDescending(c => Economy.CostOf(c, Q)); SetItems(companies); }
private static StarSystem ParseStarMapSystem(JObject response, string system) { StarSystem starSystem = new StarSystem { name = (string)response["name"], systemAddress = (long?)response["id64"], EDSMID = (long?)response["id"] }; if (response["coords"] is JObject) { var coords = response["coords"].ToObject <Dictionary <string, decimal?> >(); starSystem.x = coords["x"]; starSystem.y = coords["y"]; starSystem.z = coords["z"]; } if ((bool?)response["requirePermit"] is true) { starSystem.requirespermit = true; starSystem.permitname = (string)response["permitName"]; } if (response["information"] is JObject information) { starSystem.Reserve = ReserveLevel.FromName((string)information["reserve"]) ?? ReserveLevel.None; starSystem.population = (long?)information["population"]; // Populated system data if (starSystem.population > 0) { Faction controllingFaction = new Faction { name = (string)information["faction"], Allegiance = Superpower.FromName((string)information["allegiance"]) ?? Superpower.None, Government = Government.FromName((string)information["government"]) ?? Government.None, FactionState = FactionState.FromName((string)information["factionState"]) ?? FactionState.None }; starSystem.Faction = controllingFaction; starSystem.securityLevel = SecurityLevel.FromName((string)information["security"]) ?? SecurityLevel.None; starSystem.Economies = new List <Economy>() { Economy.FromName((string)information["economy"]) ?? Economy.None, Economy.FromName((string)information["secondEconomy"]) ?? Economy.None }; } } starSystem.lastupdated = DateTime.UtcNow; return(starSystem); }
public override string RenderValue() { var product = SelectedCompany; var ads = Markets.GetClientAcquisitionCost(product.product.Niche, Q); var income = Economy.GetUnitIncome(Q, product, 0); var change = (income - ads) * 1000; Colorize(change >= 0 ? Colors.COLOR_POSITIVE : Colors.COLOR_NEGATIVE); return(change.ToString("0.0") + "$"); }
public static long GetTargetingCost(GameEntity product, GameContext gameContext) { var cost = Economy.GetMarketingFinancingCostMultiplier(product, gameContext); var culture = Companies.GetActualCorporateCulture(product, gameContext); var creation = culture[CorporatePolicy.BuyOrCreate]; // up to 40% var discount = 100 - (creation - 1) * 5; var result = cost * discount / 100; return(result); }
public override string RenderHint() { var income = Economy.GetCompanyIncome(Q, SelectedCompany); var maintenance = Economy.GetCompanyMaintenance(Q, SelectedCompany); var bonus = new Bonus <long>("Balance change") .Append("Income", income) //.AppendAndHideIfZero("Maintenance cost", SelectedCompany.hasProduct ? -Economy.GetDevelopmentCost(SelectedCompany, GameContext) : 0) .AppendAndHideIfZero("Maintenance", -maintenance) .MinifyValues(); return(bonus.ToString()); }
public override void Help(Player p, string message) { Item item = Economy.GetItem(message); if (item == null) { Player.Message(p, "No item has that name, see %T/Eco help %Sfor a list of items."); } else { item.OnSetupCommandHelp(p); } }
public override void Use(Player p, string message, CommandData data) { string[] parts = message.SplitSpaces(2); Item item = Economy.GetItem(parts[0]); if (item == null) { Help(p); return; } if (!item.Enabled) { p.Message("%WThe {0} item is not currently buyable.", item.Name); return; } if (data.Rank < item.PurchaseRank) { Formatter.MessageNeedMinPerm(p, "+ can purchase a " + item.Name, item.PurchaseRank); return; } item.OnPurchase(p, parts.Length == 1 ? "" : parts[1]); }
long GetCompanyAcquisitionPriority(GameEntity buyer, GameEntity target, GameContext gameContext) { var price = Economy.GetCompanySellingPrice(gameContext, target.company.Id); var desireToBuy = Companies.GetDesireToBuy(buyer, target, gameContext); var modifiers = Random.Range(10, 14); var priority = modifiers * desireToBuy / (10 * (price + 1)); //Debug.Log($"Priority of {target.company.Name} in {buyer.company.Name}'s eyes: {priority}"); return(priority); }
void RenderMarketingButtons(int companyId) { var company = Companies.Get(Q, companyId); var financing = Economy.GetMarketingFinancing(company); var isReleased = company.isRelease; SetNormalMarketing.gameObject.SetActive(false); SetAggressiveMarketing.gameObject.SetActive(false); SetZeroMarketing.gameObject.SetActive(false && isReleased && financing > 0); ReleaseApp.gameObject.SetActive(false); }
public Moon(Moon source) : base(source) { MoonKind = source.MoonKind; Radius = new Distance(source.Radius); Surface = new SurfaceComposition(source.Surface); Species = new ObservableCollection <MajorSpecies>(source.Species); PresentFactions = new ObservableCollection <Faction>(source.PresentFactions); Economy = new Economy(source.Economy); CommonCulture = new Culture(source.CommonCulture); CommonGovernment = new Government(source.CommonGovernment); Civilization = new CivilizationClass(source.Civilization); Atmosphere = new AtmosphericComposition(source.Atmosphere); }
void PromoteToGroupIfPossible(GameEntity product) { var wantsToGrow = Economy.GetProfit(gameContext, product) > 500000; //Companies.IsProductWantsToGrow(product, gameContext); var isDomineering = Markets.GetPositionOnMarket(gameContext, product) == 0; var isProfitable = Economy.IsProfitable(gameContext, product); var canGrow = isDomineering && isProfitable; //if (canGrow && wantsToGrow) // Companies.PromoteProductCompanyToGroup(gameContext, product.company.Id); }
public override string RenderHint() { var product = SelectedCompany; var ads = Markets.GetClientAcquisitionCost(product.product.Niche, Q); var income = Economy.GetUnitIncome(Q, product, 0); var text = "=\nNew client marketing cost: " + ads; text += "\n/\nIncome per user: " + income; return(text); }
GameEntity[] GetCompetingCompanies() { var niches = MyCompany.companyFocus.Niches; return(Markets.GetNonFinancialCompaniesWithSameInterests(Q, MyCompany) .OrderByDescending(c => Economy.CostOf(c, Q)) .ToArray()); ////niches.Select() //return CompanyUtils.GetAIManagingCompanies(GameContext) // .OrderByDescending(c => CompanyEconomyUtils.GetCompanyCost(GameContext, c)) // .ToArray(); }
public override void ViewRender() { base.ViewRender(); var industry = MyCompany.companyFocus.Industries[0]; // get all independent nonfund companies var companies = Companies.GetIndependentCompanies(Q) .Where(Companies.IsNotFinancialStructure) .OrderByDescending(c => Economy.CostOf(c, Q)); SetItems(companies); }
void SendAcquisitionOffer(GameEntity buyer, GameEntity target, GameContext gameContext) { var cost = Economy.GetCompanyCost(gameContext, target.company.Id) * Random.Range(1, 10) / 2; if (!Companies.IsEnoughResources(buyer, cost)) { return; } Debug.Log("AI.SendAcquisitionOffer: " + buyer.company.Name + " wants " + target.company.Name); Companies.SendAcquisitionOffer(gameContext, target.company.Id, buyer.shareholder.Id, cost); }
public Asteroid(Asteroid source) : base(source) { Radius = new Distance(source.Radius); AsteroidKind = source.AsteroidKind; Surface = new SurfaceComposition(source.Surface); Species = new ObservableCollection <MajorSpecies>(source.Species); Economy = new Economy(source.Economy); CommonCulture = new Culture(source.CommonCulture); CommonGovernment = new Government(source.CommonGovernment); Civilization = new CivilizationClass(source.Civilization); PresentFactions = new ObservableCollection <Faction>(source.PresentFactions); ClassKind = source.ClassKind; }
private static StarSystem ParseEddbSystem(object response) { JObject systemJson = ((JObject)response); StarSystem StarSystem = new StarSystem { name = (string)systemJson["name"] }; if ((bool?)systemJson["is_populated"] != null) { // We have real data so populate the rest of the data // General data StarSystem.EDDBID = (long?)systemJson["id"]; StarSystem.EDSMID = (long?)systemJson["edsm_id"]; StarSystem.x = (decimal?)systemJson["x"]; StarSystem.y = (decimal?)systemJson["y"]; StarSystem.z = (decimal?)systemJson["z"]; StarSystem.Reserve = ReserveLevel.FromName((string)systemJson["reserve_type"]); // Populated system data StarSystem.population = (long?)systemJson["population"] == null ? 0 : (long?)systemJson["population"]; // EDDB uses invariant / English localized economies StarSystem.Economies[0] = Economy.FromName((string)systemJson["primary_economy"]); // At present, EDDB does not provide any information about secondary economies. StarSystem.securityLevel = SecurityLevel.FromName((string)systemJson["security"]); // Controlling faction data if ((string)systemJson["controlling_minor_faction"] != null) { Faction controllingFaction = new Faction() { EDDBID = (long?)systemJson["controlling_minor_faction_id"], name = (string)systemJson["controlling_minor_faction"], Government = Government.FromName((string)systemJson["government"]), Allegiance = Superpower.FromName((string)systemJson["allegiance"]), FactionState = FactionState.FromName((string)systemJson["state"]) }; StarSystem.Faction = controllingFaction; } // Powerplay details StarSystem.power = (string)systemJson["power"] == "None" ? null : (string)systemJson["power"]; StarSystem.powerstate = (string)systemJson["power_state"]; StarSystem.updatedat = Dates.fromDateTimeStringToSeconds((string)systemJson["updated_at"]); } StarSystem.lastupdated = DateTime.UtcNow; return(StarSystem); }
public override void Use(Player p, string message, CommandData data) { if (CheckSuper(p, message, "player name")) { return; } if (message.Length == 0) { message = p.name; } if (!Formatter.ValidName(p, message, "player")) { return; } int matches = 1; Player who = PlayerInfo.FindMatches(p, message, out matches); if (matches > 1) { return; } string target = null; int money = 0; if (matches == 0) { target = Economy.FindMatches(p, message, out money); if (target == null) { return; } } else { target = who.name; money = who.money; } string targetName = p.FormatNick(target); p.Message("Economy stats for {0}%S:", targetName); p.Message(" Current balance: &f{0} &3{1}", money, Server.Config.Currency); Economy.EcoStats ecos = Economy.RetrieveStats(target); p.Message(" Total spent: &f" + ecos.TotalSpent + " &3" + Server.Config.Currency); Output(p, ecos.Purchase, "purchase"); Output(p, ecos.Payment, "payment"); Output(p, ecos.Salary, "receipt"); Output(p, ecos.Fine, "fine"); }
void FixEconomy(GameEntity product) { if (!willBeBankrupt(product)) { Companies.Log(product, Visuals.Positive("CASH SAVED US!")); return; } Companies.Log(product, Visuals.Negative("Took cash, but this didn't help much")); //PrintFinancialStatusOfCompany(product, ref str, isTestCompany); var paidTasks = GetPaidCompanyTeamTasks(product); RenderPaidTasks(product); int triesMax = paidTasks.Count; int tries = 0; while (willBeBankrupt(product) && tries < triesMax) { tries++; if (GetPaidCompanyTeamTasks(product).Count > 0) { RemoveExpensiveTask(product); } else { Companies.Log(product, "No more tasks left"); break; } } RenderPaidTasks(product); if (!willBeBankrupt(product)) { Companies.Log(product, Visuals.Positive("Removing expensive tasks helped!")); return; } Companies.Log(product, "<b>BANKRUPTCY IS HERE...</b>"); // remove teams without tasks PrintFinancialStatusOfCompany(product); Companies.Log(product, Economy.GetProductCompanyMaintenance(product, true).MinifyValues().Minify().ToString(true)); }
void PrintFinancialStatusOfCompany(GameEntity product) { var balance = Economy.BalanceOf(product); var income = Economy.GetIncome(gameContext, product); var maintenance = Economy.GetMaintenance(gameContext, product); var profit = Economy.GetProfit(gameContext, product); Companies.Log(product, $"Balance: " + Format.Money(balance) + ", Profit: " + Visuals.PositiveOrNegativeMinified(profit) + " (Income: " + Visuals.Positive("+" + Format.Money(income)) + " Expenses: " + Visuals.Negative("-" + Format.Money(maintenance)) + ")" ); }
void OnBuyRoad() { Economy economy = Economy.Instance; bool bought; economy.OnBuy(new BuyableInfo(buyableInfo.buyInfo), out bought); if (bought) { Player player = economy.CurrentPlayer; parentNode.OnBoughtRoad(this); owner = player; player.AddBuyable(buyableInfo.buyInfo); } }
public Factory (FactoryConfig f) { config = f; currentCapacityLevel = 0; currentSpeedLevel = 0; currentQuantityLevel = 0; currentProfit = new Economy(); timeToProduceUnit = 60f / ((float)this.unitsPerMinute); _time = timeToProduceUnit; _status = FactoryStatus.WORKING; }
public override string RenderValue() { var profit = Economy.GetProfit(Q, MyCompany); var balance = Economy.BalanceOf(MyCompany); var minifiedBalance = Format.Minify(balance); if (Companies.IsHasDaughters(Q, MyCompany)) { return($"{minifiedBalance} {Visuals.PositiveOrNegativeMinified(profit)}"); } return(minifiedBalance); }
public override void ViewRender() { base.ViewRender(); var company = SelectedCompany; // Companies.Get(Q, companyId); int companyId = company.company.Id; // GetComponent<SetTargetCompany>().companyId; Income.text = "$" + Format.Minify(Economy.GetCompanyIncome(Q, company)); IncomeHint.SetHint(GetIncomeDescription(Q, companyId)); Maintenance.text = "$" + Format.Minify(Economy.GetCompanyMaintenance(Q, company)); MaintenanceHint.SetHint(GetMaintenanceDescription(Q, companyId)); }
Bonus <long> GetProfitDescriptionFull() { var bonus = new Bonus <long>("Balance change") .Append("Income", Economy.GetIncome(Q, company)); var prodMnt = Economy.GetProductCompanyMaintenance(company, true); foreach (var p in prodMnt.bonusDescriptions) { bonus.AppendAndHideIfZero(p.Name, -p.Value); } return(bonus); }
public override void Use(Player p, string message, CommandData data) { EcoTransaction trans; bool all = false; if (!ParseArgs(p, message, ref all, "give", out trans)) { return; } int matches = 1; Player who = PlayerInfo.FindMatches(p, trans.TargetName, out matches); if (matches > 1) { return; } int money = 0; if (who == null) { trans.TargetName = Economy.FindMatches(p, trans.TargetName, out money); if (trans.TargetName == null) { return; } if (ReachedMax(p, money, trans.Amount)) { return; } money += trans.Amount; Economy.UpdateMoney(trans.TargetName, money); } else { trans.TargetName = who.name; money = who.money; if (ReachedMax(p, money, trans.Amount)) { return; } who.SetMoney(who.money + trans.Amount); } trans.TargetFormatted = PlayerInfo.GetColoredName(p, trans.TargetName); trans.Type = EcoTransactionType.Give; OnEcoTransactionEvent.Call(trans); }
public void Sell() { Economy.EconomyType thisType = Economy.getTypeForConfig(_config); int currentAmount = GameState.sharedState.currentEconomy.getValueForType(thisType); int marketValue = currentAmount * _config._maxMarketValue; //TODO: this should be refactored... Economy economy = new Economy(); economy.AddForEconomyType(thisType, currentAmount); economy.AddForEconomyType(Economy.EconomyType.GOLD, -marketValue); GameState.sharedState.Purchase(economy); _parent.RefreshAllOffers(); }
public FactoryConfig(string rowID, FactoryDBRow configRow) { factoryID = rowID; name = configRow._name; description = configRow._description; baseBuildCost = new Economy(configRow._factoryBuildCostBase); // profit type baseProfit = new Economy((Economy.EconomyType)configRow._factoryUnitProfit_EconomyType, configRow._startQuantity); // cost types baseUnitCost = new Economy((Economy.EconomyType)configRow._factoryUnitCost_EconomyType_1, configRow._factoryUnitCost_Amount_1); // base baseUnitCapacity = configRow._startCapacity; baseUnitsPerMinute = configRow._startProdPerMinute; // step stepQuantity = configRow._upgradeQuantityStep; stepSpeed = configRow._upgradeSpeedStep; stepCapacity = configRow._upgradeCapacityStep; // upgrade cost upgradeCapacityBase = new Economy(configRow._upgradeCapacityCostBase_gold); upgradeSpeedBase = new Economy(configRow._upgradeSpeedCostBase_gold); upgradeQualityBase = new Economy(configRow._upgradeQuantityCostBase_gold); // max upgrades maxQuantityUpgrades = configRow._maxQuantityUpgrades; maxSpeedUpgrades = configRow._maxSpeedUpgrades; maxCapacityUpgrades = configRow._maxCapacityUpgrades; // max of this type of factory maxOfThisType = configRow._maxOfThisTypeOfFactory; }
private void produceUnit() { currentProfit += unitProfit; currentProfit.capEconomy(cappedProfit); if (currentProfit == cappedProfit) { _status = FactoryStatus.FULL; } }
public Colony() { eco = new Economy(); Name = "New colony"; }
/// <summary> /// Loads the specified file. /// </summary> /// <param name="filePath">The file path.</param> public void Load(string filePath) { FileHandler fh = new FileHandler(FilePath = filePath, FileHandler.FileOpenMode.Reading, Encoding.UTF8); int blockCount = fh.Read<int>(); Blocks = new List<Block>(blockCount); for (int i = 0; i < blockCount; i++) { Blocks.Add(new Block() { Type = (BlockType)fh.Read<int>(), Offset = fh.Read<int>() }); } for (int i = 0; i < blockCount; i++) { fh.Seek(Blocks[i].Offset, SeekOrigin.Begin); switch (Blocks[i].Type) { case BlockType.Block0: { ZoneInfo = new Block0() { ZoneType = fh.Read<int>(), ZoneWidth = fh.Read<int>(), ZoneHeight = fh.Read<int>(), GridCount = fh.Read<int>(), GridSize = fh.Read<float>(), XCount = fh.Read<int>(), YCount = fh.Read<int>() }; ZoneInfo.ZoneParts = new Block0.ZonePart[ZoneInfo.ZoneWidth, ZoneInfo.ZoneHeight]; for (int j = 0; j < ZoneInfo.ZoneWidth; j++) { for (int k = 0; k < ZoneInfo.ZoneHeight; k++) { ZoneInfo.ZoneParts[j, k] = new Block0.ZonePart() { UseMap = fh.Read<byte>(), Position = fh.Read<Vector2>() }; } } } break; case BlockType.SpawnPoints: { int spawnPointCount = fh.Read<int>(); SpawnPoints = new List<SpawnPoint>(spawnPointCount); for (int j = 0; j < spawnPointCount; j++) { SpawnPoints.Add(new SpawnPoint() { Position = new Vector3() { x = (fh.Read<float>() + 520000.00f) / 100.0f, z = fh.Read<float>() / 100.0f, y = (fh.Read<float>() + 520000.00f) / 100.0f }, Name = fh.Read<BString>() }); } } break; case BlockType.Textures: { int textureCount = fh.Read<int>(); Textures = new List<Texture>(textureCount); for (int j = 0; j < textureCount; j++) { Texture tex = new Texture(); string path = RootPath + fh.Read<BString>(); tex.Tex = Utils.loadTex(ref path); //.ToLower().Replace("\\", "/").Replace(".dds",".png"); // = Resources.LoadAssetAtPath<Texture2D>(tex.TexPath); tex.TexPath = path; Textures.Add(tex); } } break; case BlockType.Tiles: { int tileCount = fh.Read<int>(); Tiles = new List<Tile>(tileCount); for (int j = 0; j < tileCount; j++) { Tiles.Add(new Tile() { BaseID1 = fh.Read<int>(), BaseID2 = fh.Read<int>(), Offset1 = fh.Read<int>(), Offset2 = fh.Read<int>(), IsBlending = fh.Read<int>() > 0, Rotation = (RotationType)fh.Read<int>(), TileType = fh.Read<int>() }); } } break; case BlockType.Economy: { try { EconomyInfo = new Economy() { AreaName = fh.Read<BString>(), IsUnderground = fh.Read<int>(), ButtonBGM = fh.Read<BString>(), ButtonBack = fh.Read<BString>(), CheckCount = fh.Read<int>(), StandardPopulation = fh.Read<int>(), StandardGrowthRate = fh.Read<int>(), MetalConsumption = fh.Read<int>(), StoneConsumption = fh.Read<int>(), WoodConsumption = fh.Read<int>(), LeatherConsumption = fh.Read<int>(), ClothConsumption = fh.Read<int>(), AlchemyConsumption = fh.Read<int>(), ChemicalConsumption = fh.Read<int>(), IndustrialConsumption = fh.Read<int>(), MedicineConsumption = fh.Read<int>(), FoodConsumption = fh.Read<int>() }; } catch { Debug.LogError("-- Error reading the Economy Info block"); EconomyInfo = new Economy() { AreaName = string.Empty, IsUnderground = 0, ButtonBGM = string.Empty, ButtonBack = string.Empty, CheckCount = 0, StandardPopulation = 0, StandardGrowthRate = 0, MetalConsumption = 0, StoneConsumption = 0, WoodConsumption = 0, LeatherConsumption = 0, ClothConsumption = 0, AlchemyConsumption = 0, ChemicalConsumption = 0, IndustrialConsumption = 0, MedicineConsumption = 0, FoodConsumption = 0 }; } } break; } } fh.Close(); }
private void Awake() { Instance = this; //TODO load from files }
public bool CanPurchase (Economy e) { return currentEconomy.canPurchase(e); }
private Economy getCostToUpgrade(int currentLevel, int maxLevels, float exponent, Economy baseCost) { if (currentLevel >= maxLevels) { return new Economy(); } else { return baseCost.applyGrowthCurve(currentLevel, exponent); } }
public void CollectFromFactory( Factory f ) { currentEconomy += f.currentProfit; f.currentProfit = new Economy(); }