# HG changeset patch # User alys # Date 2021-01-28 02:43:37 # Node ID 09bd57319dcf23eb34315444314765f937baa8bf # Parent f7905697af6a9bb845f29f21c7b75d927054a628 Add initial version of money. diff --git a/isometric-park-fna/FNAGame.cs b/isometric-park-fna/FNAGame.cs --- a/isometric-park-fna/FNAGame.cs +++ b/isometric-park-fna/FNAGame.cs @@ -829,7 +829,15 @@ additionalInfo.Add("mouse delta", delta.ToString()); additionalInfo.Add("Tracery Test", this.output); - debugWindow.Layout(debugInfo, additionalInfo, ref show_another_window); + + additionalInfo.Add("Budget Money", this.simulation.latestBudget.money.ToString()); + additionalInfo.Add("Budget Subsidy", this.simulation.latestBudget.subsidy.ToString()); + additionalInfo.Add("Budget Upkeep", this.simulation.latestBudget.upkeep.ToString()); + additionalInfo.Add("Budget Money Prior", this.simulation.previousBudget.money.ToString()); + additionalInfo.Add("Budget Subsidy Prior", this.simulation.previousBudget.subsidy.ToString()); + additionalInfo.Add("Budget Upkeep Prior", this.simulation.previousBudget.upkeep.ToString()); + + debugWindow.Layout(debugInfo, additionalInfo, ref show_another_window); debugWindow.ImGuiLayout(); diff --git a/isometric-park-fna/Simulation.cs b/isometric-park-fna/Simulation.cs --- a/isometric-park-fna/Simulation.cs +++ b/isometric-park-fna/Simulation.cs @@ -1,8 +1,27 @@ using System; +using System.Collections.Generic; using static isometricparkfna.TileMap; namespace isometricparkfna { + public struct Budget + { + public DateTime DateTime; + public decimal money; + + + //revenue + public decimal subsidy; + + //expenses + public decimal upkeep; + + + //misc + public int trees; + + } + public class Simulation { public const int START_YEAR = 2020; @@ -37,6 +56,39 @@ public decimal money; + private List budgets; + + + public Budget latestBudget + { + get + { + if (this.budgets.Count >= 1) { + return this.budgets[this.budgets.Count - 1]; + + } + else + { + return new Budget { }; + } + } + } + + public Budget previousBudget + { + get + { + if (this.budgets.Count >= 2) { + return this.budgets[this.budgets.Count - 2]; + + } + else + { + return new Budget { }; + } + } + } + public float millisecondsPerAdvance { get; private set; } public String Season { get { @@ -65,7 +117,9 @@ private float lastAdvance; public bool paused; - private Random random; + private Random random; + + public Simulation(int width, int height, float millisecondsPerAdvance) { @@ -74,10 +128,12 @@ this.DateTime = new DateTime(START_YEAR, START_MONTH, START_DAY); this.map = new TileMap(width, height); - this.money = 1000; + this.money = 100000; this.millisecondsPerAdvance = millisecondsPerAdvance; this.paused = true; + + this.budgets = new List(); } private void advanceSimulation() @@ -108,7 +164,33 @@ cell.hasTree = false; } } + + + //this.money -= (this.map.tree_count * 1); + //this.money += 1000; + + Budget newBudget = new Budget + { + DateTime = this.DateTime, + money = this.money, + trees = this.map.tree_count, + subsidy = 1000, + upkeep = this.map.tree_count * 1 + }; + + this.budgets.Add(newBudget); + + this.applyBudget(newBudget); ; } + + public void applyBudget(Budget budget) + { + + this.money = budget.money + - (budget.upkeep) + + (budget.subsidy); + } + public void update(TimeSpan deltaTime) { //this.Tick++;