Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Xml.Schema;
- namespace WestWorldTycoon
- {
- public class Tile
- {
- // Attribute Public :
- public enum Biome
- {
- SEA, MOUNTAIN, PLAIN
- }
- // Attribute Private :
- #region AttributePrivate
- private Biome biome;
- private Building building;
- #endregion
- // Construcotr :
- public Tile(Biome b)
- {
- biome = b;
- building = null;
- }
- // Getters & Setters :
- #region GetAndSet
- public Biome GetBiome
- {
- get { return biome; }
- }
- #endregion
- public Tile(Tile tile)
- {
- // BONUS
- throw new NotImplementedException();
- }
- public bool Build(ref long money, Building.BuildingType type)
- {
- bool response = false;
- if(biome == Biome.PLAIN && building == null){
- switch (type)
- {
- case Building.BuildingType.HOUSE:
- response = money >= House.BUILD_COST;
- if (response)
- {
- building = new House();
- money -= House.BUILD_COST;
- }
- break;
- case Building.BuildingType.ATTRACTION:
- response = money >= Attraction.BUILD_COST;
- if (response)
- {
- building = new Attraction();
- money -= Attraction.BUILD_COST;
- }
- break;
- case Building.BuildingType.SHOP:
- response = money >= Shop.BUILD_COST;
- if (response)
- {
- building = new Shop();
- money -= Shop.BUILD_COST;
- }
- break;
- }
- }
- return response;
- }
- public bool Upgrade(ref long money)
- {
- bool response = false ;
- if (building != null)
- {
- switch (building.Type)
- {
- case Building.BuildingType.HOUSE:
- House house = (House)building;
- response = house.Upgrade(ref money);
- if (response) { building = house; }
- break;
- case Building.BuildingType.ATTRACTION:
- Attraction attraction = (Attraction)building;
- response = attraction.Upgrade(ref money);
- if (response) { building = attraction; }
- break;
- case Building.BuildingType.SHOP:
- Shop shop = (Shop)building;
- response = shop.Upgrade(ref money);
- if (response) { building = shop; }
- break;
- }
- }
- return response;
- }
- public long GetHousing()
- {
- long response = 0;
- if (building != null && building.Type == Building.BuildingType.HOUSE)
- {
- House house = (House)building;
- response = house.Housing();
- }
- return response;
- }
- public long GetAttractiveness()
- {
- long response = 0;
- if(building != null && building.Type == Building.BuildingType.ATTRACTION)
- {
- Attraction attraction = (Attraction)building;
- response = attraction.Attractiveness();
- }
- return response;
- }
- public long GetIncome(long population)
- {
- long response = 0;
- if(building != null && building.Type == Building.BuildingType.SHOP)
- {
- Shop shop = (Shop)building;
- response = shop.Income(population);
- }
- return response;
- }
- public bool Destroy()
- {
- // BONUS
- throw new NotImplementedException();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment