//private void Awake() //{ // _gs = GameSettings.Instance; // if (_gs == null) { Debug.LogError("SceneBuilder: No GameSettings in scene!"); } //} // Start is called before the first frame update void Start() { _gs = GameSettings.Instance; if (_gs == null) { Debug.LogError("SceneBuilder: No GameSettings in scene!"); } Dict_BoyNames = new Dictionary <char, List <string> >(); Dict_GirlNames = new Dictionary <char, List <string> >(); Dict_ItemNames = new Dictionary <char, List <string> >(); DICT_MASTER = new Dictionary <string, ListManager>(); DeliveryItem_Instances = new List <GameObject>(); Dwellers_Instances = new List <GameObject>(); BOYS_AvailableDynamicAnimalNames = Enum.GetNames(typeof(GameEnums.DynAnimal)).ToList(); GIRLS_AvailableDynamicAnimalNames = Enum.GetNames(typeof(GameEnums.DynAnimal)).ToList(); for (int x = 0; x < Enum.GetNames(typeof(GameEnums.DynAnimal)).ToList().Count; x++) { BOYS_AvailableDynamicAnimalNames[x] = "Mr." + BOYS_AvailableDynamicAnimalNames[x]; GIRLS_AvailableDynamicAnimalNames[x] = "Mrs." + GIRLS_AvailableDynamicAnimalNames[x]; //BOYS_AvailableDynamicAnimalNames[x] = BOYS_AvailableDynamicAnimalNames[x]; //GIRLS_AvailableDynamicAnimalNames[x] = GIRLS_AvailableDynamicAnimalNames[x]; } SelectedAnimalNames.AddRange(BOYS_AvailableDynamicAnimalNames); SelectedAnimalNames.AddRange(GIRLS_AvailableDynamicAnimalNames); SelectedAnimalNames.Shuffle(); BoyNamescsv = Resources.Load("Data/BoyNames237") as TextAsset; GirlNamescsv = Resources.Load("Data/GirlNames323") as TextAsset; MakeDictionaries(BoysSplitCsvGrid, BoyNamescsv, Dict_BoyNames); MakeDictionaries(GirlsSplitCsvGrid, GirlNamescsv, Dict_GirlNames); for (int x = 0; x < Enum.GetNames(typeof(GameEnums.MyItems)).ToList().Count; x++) { string itemname = ((GameEnums.MyItems)x).ToString().ToLower(); char c = itemname[0]; if (Dict_ItemNames.ContainsKey(c)) { Dict_ItemNames[c].Add(itemname); } else { Dict_ItemNames.Add(c, new List <string>() { itemname }); } } CreateRandDwellerAndItemPath(); LoadedDeliveryItemObjs = Resources.LoadAll <GameObject>("Items/NiceConstructedObjects").ToList(); List <string> temp = SelectedAnimalNames.Take <string>(_gs.Master_Number_of_Floors).ToList(); SelectedAnimalNames = temp; HashSet <char> UniqueCharToUse = new HashSet <char>(); foreach (string s in SelectedAnimalNames) { string[] words = s.Split('.'); UniqueCharToUse.Add(words[1][0]); } foreach (char c in UniqueCharToUse) { Dict_BoyNames[c].Shuffle(); Dict_GirlNames[c].Shuffle(); Dict_ItemNames[c].Shuffle(); } //create MAster Dictionary based on selected animals for (int M = 0; M < SelectedAnimalNames.Count; M++) { string name = SelectedAnimalNames[M]; char c = name.Split('.')[1][0]; string MasterKEY = (name.Split('.')[0].Length == 3) ? "g." : "b."; // Mr.Rabbit => b.r MasterKEY = MasterKEY + c; #if DebugOn Debug.Log(SelectedAnimalNames[M] + " " + " " + name.Split('.')[1] + " " + MasterKEY); #endif if (!DICT_MASTER.ContainsKey(MasterKEY)) { ListManager Lm = new ListManager(); if (MasterKEY[0] == 'b') { Lm.AssignList(Dict_BoyNames[c]); } else if (MasterKEY[0] == 'g') { Lm.AssignList(Dict_GirlNames[c]); } DICT_MASTER.Add(MasterKEY, Lm); } // add item names to master dictionary string MasterItemKEY = "i." + c; // i.r if (!DICT_MASTER.ContainsKey(MasterItemKEY)) { ListManager Lmi = new ListManager(); if (Dict_ItemNames[c] != null) { Lmi.AssignList(Dict_ItemNames[c]); // rope, root, roller DICT_MASTER.Add(MasterItemKEY, Lmi); } } } Hotel = new GameObject(); Hotel.transform.position = new Vector3(0, 0, 0); Hotel.name = "Hotel"; #if DebugOn Debug.Log("-----------------------"); #endif for (int i = 0; i < _gs.Master_Number_of_Floors; i++) { GameObject FloorObjectInstance = Instantiate(FloorObjRef); FloorObjectInstance.name = "floor_" + i; FloorObjectInstance.transform.position = new Vector3(FloorObjectInstance.transform.position.x, i * _gs.Master_Floor_Height, FloorObjectInstance.transform.position.z); HotelFloor _holtelfloorOfInstance = FloorObjectInstance.GetComponent <HotelFloor>(); _holtelfloorOfInstance.FloorNumber = i; _holtelfloorOfInstance.EarlyBuildFurniture(); GameObject Dweller = Instantiate(BaseAnimalRef, new Vector3(0, 0, 0), Quaternion.Euler(0, 180, 0)); DwellerMeshComposer dmc = Dweller.GetComponent <DwellerMeshComposer>(); dmc.Id = i; string searchkey; string ItemSearchKey; string name1 = SelectedAnimalNames[i]; Dweller.name = name1; char c = name1.Split('.')[1][0]; searchkey = (name1.Split('.')[0].Length == 3) ? "g." : "b."; // Mr.Rabbit => b.r if (searchkey == "b.") { dmc.Gender = GameEnums.Gender.Mr; } else { dmc.Gender = GameEnums.Gender.Mrs; } searchkey = searchkey + c; ItemSearchKey = "i." + c; string animalName = SelectedAnimalNames[i].Split('.')[1]; GameObject objRef = GetItemRefBySimpleName(DICT_MASTER[ItemSearchKey].NextItem()); DeliveryItem di = objRef.GetComponent <DeliveryItem>(); di.SetOwner(dmc); TempListToBeShifted.Add(objRef); #if DebugOn Debug.Log(SelectedAnimalNames[i] + " " + " " + animalName + " -> " + objRef.name); #endif GameEnums.DynAnimal a = (GameEnums.DynAnimal)Enum.Parse(typeof(GameEnums.DynAnimal), animalName); dmc.Make(a, DICT_MASTER[searchkey].NextItem()); Dwellers_Instances.Add(Dweller); FloorObjectInstance.transform.parent = Hotel.transform; HotelAsListOfFloors.Add(_holtelfloorOfInstance); } GameObject firstislast = TempListToBeShifted[0]; for (int x = 1; x < TempListToBeShifted.Count; x++) { DeliveryItem_Instances.Add(Instantiate(TempListToBeShifted[x])); } DeliveryItem_Instances.Add(Instantiate(firstislast)); //now assign the objs and the animals and the floors for (int p = 0; p < path.Length; p++) { int floortosetup = path[p]; DwellerMeshComposer dmc = Dwellers_Instances[p].GetComponent <DwellerMeshComposer>(); dmc.MyFinalResidenceFloorNumber = floortosetup; CharacterItemManager Cim = Dwellers_Instances[p].GetComponent <CharacterItemManager>(); DeliveryItem Di = DeliveryItem_Instances[p].GetComponent <DeliveryItem>(); Cim.AttachItem(Di, AnimalCharacterHands.Right); Cim.Show_LR(false, AnimalCharacterHands.Right); HotelAsListOfFloors[floortosetup].SetDweller(Dwellers_Instances[p]); } GameObject tempBEllHop = Instantiate(Hop, camlobby.BellHopLobbyPosTan.position, Quaternion.identity); HotelFloorsMNG.InitializeFLoors(HotelAsListOfFloors); GameFlow.InitializeMyThings(tempBEllHop.GetComponent <AnimalCentralCommand>(), HotelFloorsMNG, camlobby, BellhopCocation, SessionMNGR, StoryTextGen); camlobby.assignBunny(Hop); camlobby.SetInitialPos(HotelAsListOfFloors[_gs.Master_Number_of_Floors - 1].BaseCamPos.transform); }