public void AssetLoad() { var file = Resources.Load <TextAsset>(inputFile); string[] data = file.text.Split(new char[] { '\n' }); for (int i = 3; i < data.Length - 1; i++) { string[] row = data[i].Split(new char[] { ',' }); Storylet1 storylet = new Storylet1(); PreConditions preConditions = new PreConditions(); PostCondition postConditions = new PostCondition(); //Display Text storylet.TileDisplayText = row[1]; //Story Text row[2] = row[2].Replace(";", ","); row[2] = row[2].Replace("new-l", "\n"); row[2] = row[2].Replace("DQ", "\""); row[2] = row[2].Replace("INSERT_NAME", scene.player_name); storylet.StoryletText = row[2]; //Precondition Level if (int.TryParse(row[3], out int pre_level)) { preConditions.level = pre_level; } //Morality Level if (int.TryParse(row[4], out int val)) { storylet.MoralityScale = val; } //Affected Charachteristics if (row[5].Contains(";") || row[5].Contains(":")) { string[] attributes = row[5].Split(new char[] { ';' }); foreach (string attribute in attributes) { string[] value = attribute.Split(new char[] { ':' }); KeyValuePair <string, int> pair = new KeyValuePair <string, int>(value[0], int.Parse(value[1])); storylet.AddCharachterUpdates(pair); } } //Precondition Actor string[] actors = row[6].Split(new char[] { ';' }); foreach (string actor in actors) { if (!string.IsNullOrEmpty(actor) && !actor.Equals("*")) { preConditions.AddActor(actor); } } // Pre Required Player Conditions if (row[7].Contains(";") || row[7].Contains(":")) { string[] reqd_qualities = row[7].Split(new char[] { ';' }); foreach (string quality in reqd_qualities) { string[] value = quality.Split(new char[] { ':' }); KeyValuePair <string, int> pair = new KeyValuePair <string, int>(value[0], int.Parse(value[1])); preConditions.AddStoryletReq(pair); } } // Pre Required Position row[8] = row[8].Trim(); preConditions.position = row[8]; // Post Actors if ((row[9].Contains(";") || row[9].Contains(":")) && !row[9].Contains("*")) { string[] updateActors = row[9].Split(new char[] { ';' }); foreach (string update in updateActors) { if (!string.IsNullOrEmpty(update) && !update.Contains("*")) { postConditions.actors.Add(update); } } } //Post Condition Position row[10] = row[10].Trim(); postConditions.position = row[10]; //Post Level if (int.TryParse(row[11], out int post_level)) { postConditions.level_post = post_level; } //Dead People if ((row[12].Contains(";") || row[12].Contains(":")) && !row[12].Contains("*")) { string[] updateDeadActors = row[12].Split(new char[] { ';' }); postConditions.deadActor = updateDeadActors[0]; } //Interactable Obj if ((row[13].Contains(";") || row[13].Contains(":")) && !row[13].Contains("*")) { string[] obj = row[13].Split(new char[] { ';' }); postConditions.interactableObj = obj[0]; } storylet.Precondition = preConditions; storylet.Postcondition = postConditions; storylets.Add(storylet.TileDisplayText, storylet); } //foreach (KeyValuePair<string, Storylet1> storylet in storylets) //{ // Debug.Log(storylet.Key); //} }