protected override void genNextLevel() { numIncorrectAttemptsThisRound = 0; if(! isFirstLevel) { buildNRecordConfigOutcome(null); } isFirstLevel = false; currLvlConfig = (MSLevelConfig) lvlConfigGen.getNextLevelConfig(null); recordPresentedConfig(currLvlConfig); GameObject mainConveyorObj = GameObject.Find("ConveyerRight").gameObject; ConveyorScript cs1 = mainConveyorObj.GetComponent<ConveyorScript>(); GameObject returnConveyorObj = GameObject.Find("ReturnConveyerLeft"); ConveyorScript cs2 = returnConveyorObj.GetComponent<ConveyorScript>(); XRayDetectorScript xray = GameObject.Find("XRayBack").transform.FindChild("XRayDetector").GetComponent<XRayDetectorScript>(); xray.setTtsOn(false); switch(currLvlConfig.getSpeed()){ case 1: cs1.setNewSpeed(3f); cs2.setNewSpeed(3f); xray.setScanningTime(4f); break; case 2: cs1.setNewSpeed(4f); cs2.setNewSpeed(4f); xray.setScanningTime(3f); break; default: cs1.setNewSpeed(2f); cs2.setNewSpeed(2f); xray.setScanningTime(5f); break; } // TTs is used for the baskets //GameObject.Find("XRayBack").transform.FindChild("XRayDetector").GetComponent<XRayDetectorScript>().setTtsOn(currLvlConfig.getUseTtsFlag()); currNumOfPostmen = currLvlConfig.getPostmenWords().Length; jumbledParcelWords = currLvlConfig.getParcelWords(); jumbledPostmenWords = jumbleAnArray(currLvlConfig.getPostmenWords()); correctOccupiedBasketIDs.Clear(); occupiedBasketIDs.Clear(); // Select parcel prefabs. DispenserScript ds = GameObject.Find("Dispenser").GetComponent<DispenserScript>(); ds.reset(); List<int> availableIndexes = new List<int>(); for(int i=0; i<parcelPrefabs.Length; i++) { availableIndexes.Add(i); } selectedParcelPrefabIndexes = new int[jumbledParcelWords.Length]; for(int i=0; i<jumbledParcelWords.Length; i++) { int randIndex = Random.Range(0,availableIndexes.Count); int reqPrefabIndex = availableIndexes[randIndex]; selectedParcelPrefabIndexes[i] = reqPrefabIndex; availableIndexes.RemoveAt(randIndex); ds.queueItem(parcelPrefabs[reqPrefabIndex],"Parcel-"+i); } // Spawn postmen. triggerPostmenEnter(); lvlOutcome = new MSLevelOutcome(true); // Spawn boxes. }
protected override void buildNRecordConfigOutcome(System.Object[] para_extraParams) { // Build outcome object. // Trigger record outcome. recordOutcomeForConfig(lvlOutcome); lvlOutcome = new MSLevelOutcome(true); }