Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.CodeDom.Compiler;
- using System.Runtime.InteropServices;
- namespace WestWorldTycoon
- {
- public class Map
- {
- // Private Attribute :
- private Tile[,] matrix;
- // Construcotr :
- public Map(string name)
- {
- matrix = TycoonIO.ParseMap(name);
- }
- public Map(Map map)
- {
- // BONUS
- throw new NotImplementedException();
- }
- public bool Build(int i, int j, ref long money, Building.BuildingType type)
- {
- return matrix[i,j].Build(ref money, type);
- }
- public bool Destroy(int i, int j)
- {
- // BONUS
- throw new NotImplementedException();
- }
- public bool Upgrade(int i, int j, ref long money)
- {
- return matrix[i, j].Upgrade(ref money);
- }
- public long GetAttractiveness()
- {
- long response = 0;
- foreach (Tile tile in matrix)
- {
- response += tile.GetAttractiveness();
- }
- return response;
- }
- public long GetHousing()
- {
- long response = 0;
- foreach(Tile tile in matrix)
- {
- response += tile.GetHousing();
- }
- return response;
- }
- public long GetPopulation()
- {
- long housing = GetHousing();
- long attractiveness = GetAttractiveness();
- return (housing < attractiveness) ? housing : attractiveness;
- }
- public long GetIncome()
- {
- long response = 0;
- foreach(Tile tile in matrix)
- {
- response += tile.GetIncome(GetPopulation());
- }
- return response;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement