private static void CreateCustomEvent(ref StreamReader fileReader, string name, int preReqs = 0) { Debug.Log("Creating Custom Event: " + name); Debug.Log("PreReq Count: " + preReqs); PhaseEvent pEvent = new PhaseEvent(); pEvent.Name = name; // Get any prerequisites if they are present. while (preReqs > 0) { ++CurrentLine; Debug.Log("Line #" + CurrentLine); string req = fileReader.ReadLine(); if (String.IsNullOrEmpty(req) || req.Trim().Length == 0) { Debug.Log("Skipping: Empty Line"); continue; } if (req.GetWord(0, " ") != PP.EVENT_MATH_CONDITION) { Debug.LogError("Found Actions before listed number of Prerequisites were added. Event Name: " + name); Debug.Break(); } pEvent.AddConditional(CreateConditional(req)); --preReqs; } while (true) { string line = fileReader.ReadLine(); line = line.Trim(); ++CurrentLine; Debug.Log("Line #" + CurrentLine); if (String.IsNullOrEmpty(line) || line.Trim().Length == 0) { Debug.Log("Skipping: Empty Line"); continue; } if (line.GetWord(0, " ") == PP.CUSTOM_EVENT_CLOSE) { Debug.Log("End of " + name + " event"); break; } if (line.GetWord(0, " ") == PP.EVENT_MATH_CONDITION) { Debug.LogError("Found a condition where one should not be. Event Name: " + name); Debug.Break(); } PhaseEventStep eStep = new PhaseEventStep(); eStep.Action = line.GetWord(0, " "); Debug.Log("Set Action to " + eStep.Action); List <KeyValuePair <string, string> > values = BreakLine(line); foreach (KeyValuePair <string, string> pair in values) { SetProperty(eStep, pair.Key, pair.Value); } pEvent.AddStep(eStep); } CurrentPhase.AddPhaseEvent(pEvent); }