-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBusinessLogic.cs
75 lines (63 loc) · 1.85 KB
/
BusinessLogic.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using UnityEngine;
//This class is all mine. A bit convoluted and perhaps slightly unneccesary to keep it as a separate class
// but I did it for the clarity of understanding what numbers are being shunted from where to where.
public class BusinessLogic:MonoBehaviour
{
public int fleetSize;
public float unitCostIdle;
public float unitCostActive;
public float fleetCost;
public float profit;
public float revenue;
public float initFleetCost;
BuildCity city;
GameObject mainController;
public float getRevenue()
{
return revenue;
}
public float getUnitCostActive()
{
return unitCostActive;
}
public float getUnitCostIdle()
{
return unitCostIdle;
}
public float getFleetCost()
{
return fleetCost;
}
public int getFleetSize()
{
return fleetSize;
}
public float getProfit()
{
return profit;
}
public void Awake()
{
mainController = GameObject.Find("MainController");
}
public void Start()
{
city = mainController.GetComponent<UIControl>().getCity();
fleetSize = 0;
unitCostActive = 20.0f;
unitCostIdle = 5.0f;
initFleetCost = 0.0f;
fleetCost = 500.0f;
revenue = 0.0f;
profit = 0.0f;
}
public void Update()
{
city.UpdateFleetStatus();
fleetSize = city.getFleetSize();
initFleetCost = fleetSize * unitCostIdle;
fleetCost = initFleetCost + (((unitCostIdle * city.fleetCountIdle) + (unitCostActive * city.fleetCountActive)) * Time.fixedTime*0.001f);
revenue = city._revenue;
profit = revenue - fleetCost;
}
}