private void Start() { InvokeRepeating("CheckForTimeOfDay", 0.25f, 0.15f); SavingKeysContainer.OnSaveGame += HandleOnSaveGame; SavingKeysContainer.OnLoadGame += HandleOnLoadGame; activitiesList = GetComponent <NightActivities> ().nightActivitiesList; for (int i = 0; i < Building_Script.buildingIDs.Count; i++) { Building_Script buildRef = Building_Script.GetBuilding(Building_Script.buildingIDs[i]); buildRef.firstVisitToday = true; } }
static protected void SetReferencesBetweenResourcesAndDesignBuildings(List <string> existing) { for (int i = 0; i < existing.Count; i++) { string exist = existing[i]; for (int j = 0; j < Building_Script.buildingIDs.Count; j++) { string script = Building_Script.buildingIDs[j]; if (exist == script) { Manager_Resources.GetBuildingByID(exist).building = Building_Script.GetBuilding(script); Building_Script.GetBuilding(script).resources = Manager_Resources.GetBuildingByID(exist); } } } }
static protected List <string> GenerateShopkeeperResources(List <string> occupiedBuildingResources, string scenarioID, JSONObject json) { for (int i = 0; i < json.Count; i++) { JSONObject shopkeeper = json[i]; Resources_Shopkeeper newShopkeeper = new Resources_Shopkeeper( //id, name, image, gender, home, money, income, expenses, //strength, respect, fear, greed, integrity, stubbornness, personality, inventory shopkeeper.GetField("id").str, shopkeeper.GetField("name").str, shopkeeper.GetField("image").str, Enums.GenderFromString(shopkeeper.GetField("gender").str), Manager_Resources.GetBuildingByID(shopkeeper.GetField("home").str), Mathf.Clamp(int.Parse(shopkeeper.GetField("money").str), moneyMin, moneyMax), Mathf.Clamp(int.Parse(shopkeeper.GetField("income").str), moneyMin, moneyMax), Mathf.Clamp(int.Parse(shopkeeper.GetField("expenses").str), moneyMin, moneyMax), Mathf.Clamp(int.Parse(shopkeeper.GetField("strength").str), statMin, statMax), Mathf.Clamp(int.Parse(shopkeeper.GetField("respect").str), statMin, statMax), Mathf.Clamp(int.Parse(shopkeeper.GetField("fear").str), statMin, statMax), Mathf.Clamp(int.Parse(shopkeeper.GetField("greed").str), statMin, statMax), Mathf.Clamp(int.Parse(shopkeeper.GetField("integrity").str), statMin, statMax), Mathf.Clamp(int.Parse(shopkeeper.GetField("stubbornness").str), statMin, statMax), Enums.PersonalityFromStatic(shopkeeper.GetField("personality").str), Resources_Inventory.GetInventoryByID(shopkeeper.GetField("inventory").str) ); if (occupiedBuildingResources.Contains(shopkeeper.GetField("home").str)) { Debug.LogError("Whoa there, Sally. Someone done goofed. Go tell whoever was messing with the static data that " + shopkeeper.GetField("id").str + " can't set up shop in " + shopkeeper.GetField("home").str + ". Someone else is already in there! -Scott"); } else { occupiedBuildingResources.Add(shopkeeper.GetField("home").str); // to be moved to a different section Building_Script buildingScriptRef = Building_Script.GetBuilding(shopkeeper.GetField("home").str); if (buildingScriptRef != null) { buildingScriptRef.shopkeeper = newShopkeeper; } } } return(occupiedBuildingResources); }
static protected void MakeSureAllDesignBuildingsHaveExistingResources(List <string> existing) { for (int i = 0; i < Building_Script.buildingIDs.Count; i++) { string script = Building_Script.buildingIDs[i]; bool found = false; for (int j = 0; j < existing.Count; j++) { string exist = existing[j]; if (exist == script) { Building_Script.GetBuilding(script).resources = Manager_Resources.GetBuildingByID(exist); found = true; break; } } if (!found) { Debug.LogError("BUILDING HARMONY ISSUE: The Building Script '" + script + "' exists in design land, but is not declared in data."); } } }
static protected void MakeSureAllExistingResourcesHaveDesignBuildings(List <string> existing) { for (int i = 0; i < existing.Count; i++) { string exist = existing[i]; bool found = false; for (int j = 0; j < Building_Script.buildingIDs.Count; j++) { string script = Building_Script.buildingIDs[j]; if (exist == script) { Manager_Resources.GetBuildingByID(exist).building = Building_Script.GetBuilding(script); found = true; break; } } if (!found) { Debug.LogError("BUILDING HARMONY ISSUE: The Building Resource '" + exist + "' is declared in data but does not exist in design land."); } } }