private void buildMission() { MissionConfig mission = MissionConfig.Instance; // Pick the correct X-ray machine string locationXrayMachineName = room.GetComponent <Room>().setLocation(mission.location); GameObject locationXrayMachine = null; foreach (GameObject xrayMachine in xrayMachines) { if (xrayMachine.name == locationXrayMachineName) { locationXrayMachine = xrayMachine; break; } } if (locationXrayMachine == null) { locationXrayMachine = xrayMachines[0]; } GameObject xrayMachineGameObject = Instantiate(locationXrayMachine, locationXrayMachine.transform.position, Quaternion.identity); currentXrayMachine = xrayMachineGameObject.GetComponent <XRayMachine> (); currentXrayMachine.attachConnectingConveyors(); // Pick the correct time piece GameObject locationClock = null; foreach (GameObject clock in clocks) { if (clock.name == mission.clockType) { locationClock = clock; break; } } if (locationClock == null) { locationClock = clocks[0]; } GameObject clockObject = Instantiate(locationClock); currentClock = clockObject.GetComponent <Clock> (); currentClock.setTime(mission.startTime); currentClock.speed = mission.timeSpeed; currentClock.notifyOnTime(mission.endTime); PubSub.subscribe("MISSION_TIME_END", this); currentClock.setRandomPosition = false; currentClock.clockPosition = mission.clockPosition; // Set the encounter and bag seeds ItsRandom.setRandomSeeds(mission.seedsConfig.bags, "bags"); ItsRandom.setRandomSeeds(mission.seedsConfig.people, "people"); }