public bool PlaceBuilding(int x, int y, BuildingTypes type, bool free = false) { if (!map.CellAtPositionIsType(x, y, CellType.Empty) || (!free && Money - 2000 < 0)) { return(false); } CityThing t = new CityThing(); t.cell = map.CellAtPosition(x, y); t.type = CellType.Building; t.Size = (int)type; t.Name = "A building (" + type.ToString() + ")"; t.state = ThingState.Normal; t.cell.thing = t; totalBuildings++; if (!free) { Money -= 2000; } return(true); }
/// <summary> /// This function decreases the variable that keeps track of how many buildings are build. /// </summary> /// <param name="building">Takes in the building type of which building the amount has been decreased.</param> public static void DecreaseAmountBuilding(BuildingTypes building) { BuildingType actualBuilding = BuildingType.none; if (building == BuildingTypes.Bakery) { actualBuilding = BuildingType.bakery; } else if (building.ToString().Contains("House")) { actualBuilding = BuildingType.house; } else { actualBuilding = BuildingType.none; } switch (actualBuilding) { case BuildingType.bakery: TotalAmountBakery--; ResourceManager.CalculateNewResourceAmount(ResourceType.bread); break; case BuildingType.house: TotalAmountHouses--; ResourceManager.CalculateNewResourceAmount(ResourceType.villagers); OnHouseBuild?.Invoke(); break; case BuildingType.none: break; } }
public override void CreateBuilding(BuildingTypes type) { base.CreateBuilding(type); Quests.UpdateActiveQuests(QuestObjective.Type.BuildObjects, 1, QuestObjective.Enemy.None, -1, QuestObjective.Weapon.None, type.ToString()); }
public override void CreateBuilding(BuildingTypes type) { base.CreateBuilding(type); ModAPI.Console.Write(type.ToString(), "building finished"); Quests.UpdateActiveQuests(QuestObjective.Type.BuildObjects, 1, QuestObjective.Enemy.None, -1, QuestObjective.Weapon.None, type.ToString()); }
public override string ToString() { return(buildingType.ToString()); }