Description:
Make contract generation more varied.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -29,7 +29,7 | |||||
|
29 | - Add contract struct @milestone(3: Contracts) @nvm |
|
29 | - Add contract struct @milestone(3: Contracts) @nvm |
|
30 | - Add tree simulation @milestone(3: Contracts) |
|
30 | - Add tree simulation @milestone(3: Contracts) |
|
31 | - Add contract generation @milestone(3: Contracts) |
|
31 | - Add contract generation @milestone(3: Contracts) |
|
32 |
- Outline reserved areas @milestone(3: Contracts) @done(2021-04- |
|
32 | - Outline reserved areas @milestone(3: Contracts) @done(2021-04-09) |
|
33 | - Add company images @milestone(3: Contracts) @maybe |
|
33 | - Add company images @milestone(3: Contracts) @maybe |
|
34 | Trees: |
|
34 | Trees: |
|
35 | - Add basic maintenance cost @milestone(1: Basic Money) @done(2021-01-27) |
|
35 | - Add basic maintenance cost @milestone(1: Basic Money) @done(2021-01-27) |
@@ -53,10 +53,17 | |||||
|
53 |
|
53 | ||
|
54 | // SetComponent(entity, new BudgetComponent{currentBudget = this.simulation.latestBudget, |
|
54 | // SetComponent(entity, new BudgetComponent{currentBudget = this.simulation.latestBudget, |
|
55 | // priorBudget = this.simulation.previousBudget}); |
|
55 | // priorBudget = this.simulation.previousBudget}); |
|
56 | if (status == ContractStatus.Accepted) |
|
56 | switch (budgetComponent.category) |
|
57 | { |
|
57 | { |
|
58 | new_contract_amount += budgetComponent.amount; |
|
58 | case "Contracts": |
|
|
59 | |||
|
|
60 | if (status == ContractStatus.Accepted) | ||
|
|
61 | { | ||
|
|
62 | new_contract_amount += budgetComponent.amount; | ||
|
|
63 | } | ||
|
|
64 | break; | ||
|
59 | } |
|
65 | } |
|
|
66 | |||
|
60 | } |
|
67 | } |
|
61 |
|
68 | ||
|
62 | simulation.contracts = new_contract_amount; |
|
69 | simulation.contracts = new_contract_amount; |
@@ -14,6 +14,10 | |||||
|
14 | { |
|
14 | { |
|
15 | private Random random_generator; |
|
15 | private Random random_generator; |
|
16 |
|
16 | ||
|
|
17 | public const int DEFAULT_SQUARES = 25; | ||
|
|
18 | public const int CONTRACT_MINIMUM = 50; | ||
|
|
19 | public const int CONTRACT_MAXIMUM = 250; | ||
|
|
20 | |||
|
17 | public ContractSpawner() |
|
21 | public ContractSpawner() |
|
18 | { |
|
22 | { |
|
19 | this.random_generator = new Random(); |
|
23 | this.random_generator = new Random(); |
@@ -59,14 +63,19 | |||||
|
59 | { |
|
63 | { |
|
60 | var contract = CreateEntity(); |
|
64 | var contract = CreateEntity(); |
|
61 |
|
65 | ||
|
62 |
|
|
66 | var max_squares = (message.max_squares == null) ? DEFAULT_SQUARES : message.max_squares; |
|
|
67 | var squares = (message.squares == null) ? CreateArea(25, 25, max_squares) : message.squares; | ||
|
|
68 | |||
|
|
69 | var contract_amount = random_generator.Next(CONTRACT_MINIMUM, CONTRACT_MAXIMUM); | ||
|
63 |
|
70 | ||
|
64 | // AddComponent |
|
71 | // AddComponent |
|
65 | AddComponent(contract, new AreaComponent { squares = squares }); |
|
72 | AddComponent(contract, new AreaComponent { squares = squares }); |
|
66 | AddComponent(contract, new NameComponent { DisplayName = message.name }); |
|
73 | AddComponent(contract, new NameComponent { DisplayName = message.name }); |
|
67 | AddComponent(contract, new ContractStatusComponent { status = ContractStatus.Proposed }); |
|
74 | AddComponent(contract, new ContractStatusComponent { status = ContractStatus.Proposed }); |
|
68 |
AddComponent(contract, new BudgetLineComponent { category = "Contracts", |
|
75 | AddComponent(contract, new BudgetLineComponent { category = "Contracts", |
|
|
76 | //Round to the nearest $5 | ||
|
|
77 | amount = (decimal)((contract_amount/5)*5) }); | ||
|
69 |
|
78 | ||
|
70 | } |
|
79 | } |
|
71 | } |
|
80 | } |
|
72 | } No newline at end of file |
|
81 | } |
You need to be logged in to leave comments.
Login now