// Use this for initialization void Start () { Messenger.AddListener<float>("Run Timer", UpdateEvents); PoIList = new Dictionary<int, PoIBase>(); HireableList = new Dictionary<int, PoIBase>(); //Read data from system file. string filePath = System.IO.Path.Combine(Application.streamingAssetsPath, "PoIData.txt"); string txt = System.IO.File.ReadAllText(filePath); JSONNode temp = JSONNode.Parse(txt); Hireables = temp["hireable"].AsArray; FillHireableRoster(); foreach(JSONNode node in temp["initial"].AsArray) { PoIBase newPOI = new PoIBase(); newPOI.InitializePoIBase(node); GlobalPlayerData.Staff.Add (idGen++, newPOI); } foreach(JSONNode node in temp["pois"].AsArray) { PoIBase newPOI = new PoIBase(); newPOI.InitializePoIBase(node); PoIList.Add (idGen++, newPOI); } }
public void FillHireableRoster() { //Debug.Log("hireme"); int temp = HireableList.Count; for (int i = 0; i < maxNewHires - temp; i++) { PoIBase newPOI = new PoIBase(); //Create a personality from the PoIList if (Random.Range(0.0f, 1.0f) >= 0.3f && Hireables.Count > 0) { Debug.Log("Personality"); int randomNumber = Random.Range(0, Hireables.Count); JSONNode node = Hireables[randomNumber]; Hireables.Remove(randomNumber); newPOI.InitializePoIBase(node); } //Create a randomized personality for players to customize else { //Debug.Log("Random"); newPOI.InitializeEssentials(); //Generate Random Hireable Staff; newPOI.FirstName = Faker.Name.First(); newPOI.LastName = Faker.Name.Last(); //Need to add decent titles to Faker! newPOI.Title = "Dr."; //Need to add nicknames to Faker! newPOI.NickName = ""; System.Array array = System.Enum.GetValues(typeof(Personality)); newPOI.personality = (Personality)array.GetValue(Random.Range(0, array.Length)); //Recruiter notes? Probably something generic tying in a couple of the random details. Make it editable in case players want to add notes. //Accreditation? //Think about traits and specialties float x = Random.Range(0.0f,1.0f); float y = Random.Range(0.0f,1.0f - x); newPOI.Paradigm = new Vector3(x,y,Random.Range(0.0f,1.0f - (x + y))); //Debug.Log(newPOI.FirstName); //Also need to figure out what random pictures will be like newPOI.SpriteFile = ""; newPOI.UpdatePsychReport(); } HireableList.Add (idGen++, newPOI); } }