private void CreateScriptedCharacters() { int ID; string[] firstAndLast = new string[2]; int gender; string[] names = (scriptedCharacterNamesText.text).Split('\n'); string[] listsOfTraits = (scriptedCharacterTraits.text).Split('\n'); string[] listOfTraits; int[] traitsToInt = new int[5]; int[] goalsToInt = new int[5] { 1, 2, 3, 4, 5 }; string[] goals; Array loves = Enum.GetValues(typeof(loves)); Array likes = Enum.GetValues(typeof(likes)); Array okays = Enum.GetValues(typeof(okays)); Array dislikes = Enum.GetValues(typeof(dislikes)); Array hates = Enum.GetValues(typeof(hates)); System.Random rand = new System.Random(); loves[] randomLoves; likes[] randomLikes; okays[] randomOkays; dislikes[] randomDislikes; hates[] randomHates; for (int i = 0; i < 10; i++) { ID = 1000 + i; firstAndLast = names[i].Split(' '); gender = UnityEngine.Random.Range(0, 2); listOfTraits = listsOfTraits[i].Split(' '); traitsToInt = new int[5]; for (int j = 0; j < 5; j++) { traitsToInt[j] = Convert.ToInt16(listOfTraits[j]); } Character tempChar = new Character(ID, firstAndLast[0], firstAndLast[1], gender, 20, 100, traitsToInt, goalsToInt, goalsToInt); randomLoves = new loves[5]; randomLikes = new likes[5]; randomOkays = new okays[5]; randomDislikes = new dislikes[5]; randomHates = new hates[5]; for (int j = 0; j < 5; j++) { randomLoves[j] = (loves)loves.GetValue(rand.Next(loves.Length)); randomLikes[j] = (likes)likes.GetValue(rand.Next(likes.Length)); randomOkays[j] = (okays)okays.GetValue(rand.Next(okays.Length)); randomDislikes[j] = (dislikes)dislikes.GetValue(rand.Next(dislikes.Length)); randomHates[j] = (hates)hates.GetValue(rand.Next(hates.Length)); } tempChar.SetPreferences(randomLoves); tempChar.SetPreferences(randomLikes); tempChar.SetPreferences(randomOkays); tempChar.SetPreferences(randomDislikes); tempChar.SetPreferences(randomHates); if (ID == 1000) { tempChar.AddBehavior(1, 0); tempChar.AddBehavior(2, 1); tempChar.SetLocation(6003); int[] trainings = new int[] { 1, 0, 0 }; tempChar.SetTrainings(trainings); int[][] trainingHours = new int[3][]; trainingHours[0] = new int[] { 7, 11 }; tempChar.SetTrainingHours(trainingHours); int[] missions = new int[] { 1, 0, 0 }; int[][] missionTimes = new int[3][]; missionTimes[0] = new int[] { 12, 13 }; tempChar.SetMissions(missions); tempChar.SetMissionTimes(missionTimes); } if (ID == 1001) { tempChar.SetLocation(6003); } if (ID == 1002) { tempChar.SetLocation(6003); tempChar.AddConvo(2, 1); } if (ID == 1003) { tempChar.SetLocation(6003); } if (ID < 1004) { //tempChar.SetLocation(6003); tempChar.SetImportance(1); } if (ID == 1005 || ID == 1006) { tempChar.SetGender(0); } if (ID == 1007 || ID == 1008) { tempChar.SetLocation(7); tempChar.SetImportance(1); } if (ID == 1009) { tempChar.SetImportance(1); } completeListOfCharacters.Add(tempChar); } }
private void CreateCharacters() { Array loves = Enum.GetValues(typeof(loves)); Array likes = Enum.GetValues(typeof(likes)); Array okays = Enum.GetValues(typeof(okays)); Array dislikes = Enum.GetValues(typeof(dislikes)); Array hates = Enum.GetValues(typeof(hates)); System.Random rand = new System.Random(); loves[] randomLoves; likes[] randomLikes; okays[] randomOkays; dislikes[] randomDislikes; hates[] randomHates; for (int i = 0; i < 1000; i++) { Character tempChar = new Character(); //assign gender; 0 male, 1 female tempChar.SetGender(UnityEngine.Random.Range(0, 2)); //use gender to get a random name if (tempChar.GetGender() == 0) { tempChar.SetFirstName(GetRandomMaleFirstName()); } else { tempChar.SetFirstName(GetRandomFemaleFirstName()); } //get random last name tempChar.SetLastName(GetRandomLastName()); //add five random traits int[] tempTraits = new int[5]; for (int j = 0; j < 5; j++) { tempTraits[j] = GetRandomTraitIndex(); } tempChar.SetTraits(tempTraits); //add five random skills int[] tempSkills = new int[5]; for (int j = 0; j < 5; j++) { tempSkills[j] = GetRandomSkillIndex(); } tempChar.SetSkills(tempSkills); //add five random goals int[] tempGoals = new int[5]; for (int j = 0; j < 5; j++) { tempGoals[j] = GetRandomGoalIndex(); } tempChar.SetGoals(tempGoals); if (UnityEngine.Random.Range(0, 1000) < 40) { tempChar.SetLocation(3); } randomLoves = new loves[5]; randomLikes = new likes[5]; randomOkays = new okays[5]; randomDislikes = new dislikes[5]; randomHates = new hates[5]; for (int j = 0; j < 5; j++) { randomLoves[j] = (loves)loves.GetValue(rand.Next(loves.Length)); randomLikes[j] = (likes)likes.GetValue(rand.Next(likes.Length)); randomOkays[j] = (okays)okays.GetValue(rand.Next(okays.Length)); randomDislikes[j] = (dislikes)dislikes.GetValue(rand.Next(dislikes.Length)); randomHates[j] = (hates)hates.GetValue(rand.Next(hates.Length)); } tempChar.SetPreferences(randomLoves); tempChar.SetPreferences(randomLikes); tempChar.SetPreferences(randomOkays); tempChar.SetPreferences(randomDislikes); tempChar.SetPreferences(randomHates); completeListOfCharacters.Add(tempChar); } }