private void findStressProcessor() { if (stressProcessor == null) { int count = SnacksScenario.Instance.resourceProcessors.Count; for (int index = 0; index < count; index++) { if (SnacksScenario.Instance.resourceProcessors[index] is StressProcessor) { stressProcessor = (StressProcessor)SnacksScenario.Instance.resourceProcessors[index]; break; } } } }
/// <summary> /// Loads the SNACKS_RESOURCE_PROCESSOR config nodes and returns a list of processors. /// </summary> /// <returns>A list of resource processors.</returns> public static List <BaseResourceProcessor> LoadProcessors() { List <BaseResourceProcessor> resourceProcessors = new List <BaseResourceProcessor>(); BaseResourceProcessor resourceProcessor; ConfigNode[] nodes = GameDatabase.Instance.GetConfigNodes(ProcessorNode); ConfigNode node; //Add the Stress processor if Stress is defined if (SnacksScenario.Instance.rosterResources.ContainsKey(StressProcessor.StressResourceName)) { StressProcessor stressProcessor = new StressProcessor(); stressProcessor.Initialize(); resourceProcessors.Add(stressProcessor); } //Now go through all the config nodes and load them for (int index = 0; index < nodes.Length; index++) { node = nodes[index]; if (!node.HasValue("name")) { continue; } if (node.GetValue("name") == SnacksResourceProcessor.SnacksProcessorName) { //Add the snacks processor SnacksResourceProcessor snacksProcessor = new SnacksResourceProcessor(); snacksProcessor.Initialize(); resourceProcessors.Add(snacksProcessor); } else { resourceProcessor = new BaseResourceProcessor(node); resourceProcessor.Initialize(); resourceProcessors.Add(resourceProcessor); } } //Return all the processors return(resourceProcessors); }