//PULLS DATA FROM LIST<STRING> AND STORES IT IN STRUCTURE (SCENARIO 1) private Scenario1Data ImportScenario1Data(List <string> scenarioTextFile, List <string> hotspotTextFile, int routesStartAtLine) { Scenario1Data scenarioData = new Scenario1Data(); scenarioData.hotspotsURL = new List <string>(); scenarioData.routes = new List <string>(); //Scenario 1 (Routes start at line #2) scenarioData.start = scenarioTextFile.ElementAt(0); //Start string scenarioData.startCoord = routeManager.SplitCoordinates(scenarioData.start); //Start coordinates (coord, dir) scenarioData.checkpoints = scenarioTextFile.ElementAt(1).Split(',').ToList(); scenarioData.hotspots = hotspotTextFile.ElementAt(0).Split(',').ToList(); scenarioData.routesCount = scenarioTextFile.Count - routesStartAtLine; for (int i = 1; i < hotspotTextFile.Count; i++) // List of all URL { scenarioData.hotspotsURL.Add(hotspotTextFile.ElementAt(i)); //Debug.Log("Hotspots URL: " + string.Join("+", scenario1S0Data.hotspotsURL)); } for (int i = routesStartAtLine; i < scenarioTextFile.Count; i++) // List of all routes { scenarioData.routes.Add(scenarioTextFile.ElementAt(i)); //Debug.Log("Scenario 1 - routesToDraw: " + string.Join("+", scenario1S0Data.routesToDraw)); } return(scenarioData); }
public ScenarioStdData activeScenario = new ScenarioStdData(); //currently selected scenario (for 2-5) private void Awake() { //Initialise Components routeManager = GetComponent <RouteManager>(); checkpointManager = GetComponent <CheckpointManager>(); intersectionManager = GetComponent <IntersectionManager>(); player = GameObject.FindGameObjectWithTag("Player"); playerController = player.GetComponent <PlayerController>(); gameManager = FindObjectOfType <GameManager>().GetComponent <GameManager>(); hotspotManager = FindObjectOfType <GameManager>().GetComponent <HotspotManager>(); uIManager = FindObjectOfType <GameManager>().GetComponent <UIManager>(); // Import data session from GlobalControl //selectedScenario = GlobalControl.instance.activeSequence; // selectedRoute = GlobalControl.instance.activeRoute; //sessionData = GlobalControl.instance.sessionData; // isGroupSession, groupID, studentIDs, isSender //TODO: Move to gameManager importPath = Path.Combine(Directory.GetCurrentDirectory(), "Assets/Media/Text/"); ImportAllTextFiles(); //Import text files containing //IMPORT SCENARIOS DATA FROM TEXT FILES scenario1S0Data = ImportScenario1Data(scenario1S0TextFile, hotspotManager.hotspotTextS0, 2); //Scenario 1 scenario1S6Data = ImportScenario1Data(scenario1S6TextFile, hotspotManager.hotspotTextS6, 2); //Scenario 6 scenario2Data = ImportScenarioStdData(scenario2TextFile, 2); //Scenario 2 scenario3Data = ImportScenarioStdData(scenario3TextFile, 2); //Scenario 3 scenario4Data = ImportScenarioStdData(scenario4TextFile, 2); //Scenario 4 scenario5Data = ImportScenarioStdData(scenario5TextFile, 2); // Scenario 5 }
//SCENARIO 1 - HOTSPOTS + VALIDATION BY CHECKPOINTS private void Scenario1(Scenario1Data scenarioData) { scenario1Props.SetActive(true); routeManager.validationEnabled = true; //Validation is possibles attemptsLimited = false; validationsLimited = false; gameManager.attemptsAllowed = false; gameManager.sessionData.selectedRouteCoord = new List <string>(); //Read data from routeS1 gameManager.sessionData.routeStart = scenarioData.startCoord; checkpointManager.allCheckpoints = new List <string>(scenarioData.checkpoints); hotspotManager.allHotspots = new List <string>(scenarioData.hotspots); //Routes import for (int i = 0; i < scenarioData.routesCount; i++) { List <string> tempRoute = scenarioData.routes[i].Split(',').ToList(); routeManager.SpawnLine(tempRoute, i); } checkpointManager.GenerateCheckpoints(checkpointManager.allCheckpoints); hotspotManager.GenerateHotspots(hotspotManager.allHotspots, scenarioData.hotspotsURL); ////Set scenario variables //allowedAttempts = 1; //allowedValidations = 1; }