// Loops through all the people and alerts those attracted by the store public static void AlertPeopleAffectedByStore(HouseManager.HouseType type, int numPeople, Vector3 storePos, List <Person> stalledPeople) { if (numPeople == 0) { return; } Person[] toBePulled; if (type == HouseManager.HouseType.STORE) { toBePulled = GetPeopleAffectedNormalStore(storePos, numPeople, stalledPeople); } else if (type == HouseManager.HouseType.DONUT) { toBePulled = GetPeopleAffectedSpecialStore(storePos, "PersonPolice", numPeople, stalledPeople); } else if (type == HouseManager.HouseType.BANK) { toBePulled = GetPeopleAffectedSpecialStore(storePos, "PersonBanker", numPeople, stalledPeople); } else { return; } foreach (Person toPull in toBePulled) { if (toPull != null) { toPull.OnStorePull(GridManager.CoordsToIndex((int)Mathf.Round(storePos.x), (int)Mathf.Round(storePos.y))); } } }
// Returns whether or not the given house type is unlocked public static bool IsBuildingUnlocked(HouseManager.HouseType type) { switch (type) { case HouseManager.HouseType.HOUSE: return(instance.houseUnlocked); case HouseManager.HouseType.APARTMENT: return(instance.apartmentUnlocked); case HouseManager.HouseType.MANSION: return(instance.mansionUnlocked); case HouseManager.HouseType.STORE: return(instance.storeUnlocked); case HouseManager.HouseType.DONUT: return(instance.donutUnlocked); case HouseManager.HouseType.BANK: return(instance.bankUnlocked); default: return(false); } }
private static HouseManager.HouseType CheckLocked(HouseManager.HouseType type) { if (ContentManager.IsBuildingUnlocked(type)) { return(type); } else { return(HouseManager.HouseType.LOCKED); } }
private static void SetBuildOptionsForCaller(HouseManager.HouseType type) { if (type == HouseManager.HouseType.PLOT) { buildOptions[0] = CheckLocked(HouseManager.HouseType.HOUSE); buildOptions[1] = CheckLocked(HouseManager.HouseType.STORE); } else if (type == HouseManager.HouseType.HOUSE) { buildOptions[0] = CheckLocked(HouseManager.HouseType.APARTMENT); buildOptions[1] = CheckLocked(HouseManager.HouseType.MANSION); } else if (type == HouseManager.HouseType.STORE) { buildOptions[0] = CheckLocked(HouseManager.HouseType.DONUT); buildOptions[1] = CheckLocked(HouseManager.HouseType.BANK); } else { Debug.Log("Error: Invalid callType passed to BuildMenu"); } }
void OnGUI() { if (open) { // close if clicking elsewhere if (Input.GetMouseButtonDown(0)) { Vector2 mouse = Input.mousePosition; if (!backgroundRect.Contains(new Vector2(mouse[0], Screen.height - mouse[1]))) { Close(); } } // respond to button clicks GUI.Box(backgroundRect, ""); HouseManager.HouseType firstType = buildOptions[0]; HouseManager.HouseType secondType = buildOptions[1]; if (firstType == HouseManager.HouseType.LOCKED) { GUI.Box(firstBuildRect, "LOCKED", textStyle); } else { if (HouseManager.CanBuild(firstType)) { if (GUI.Button(closeRect, "x")) { Close(); } else if (GUI.Button(firstBuildRect, firstType.ToString() + "\n$" + HouseManager.GetCost(firstType))) { Close(); Build(firstType); } } else { GUI.Box(firstBuildRect, "NEED $$$", textStyle); } } if (secondType == HouseManager.HouseType.LOCKED) { GUI.Box(secondBuildRect, "LOCKED", textStyle); } else { if (HouseManager.CanBuild(secondType)) { if (GUI.Button(secondBuildRect, secondType.ToString() + "\n$" + HouseManager.GetCost(secondType))) { Close(); Build(secondType); } } else { GUI.Box(secondBuildRect, "NEED $$$", textStyle); } } } }
private void Build(HouseManager.HouseType type) { builder.OnBuild(); HouseManager.Build(worldPos, type); }