private void CreateLevel() { levelData.LoadLevelData(DataScript.currentLevel); colorScript.ColorizeTheLevel(levelData.levelStyle); rotatingObjects = levelData.rotatingObjects; boxes = levelData.boxes; whirlwinds = levelData.whirlwinds; obstaclePositions = levelData.obstaclePositions; DataScript.ballCount = levelData.ballCount; counterScript.SetInGameBallCounter(); cameraScale = levelData.cameraScale; cameraScaler.SetCameraScale(cameraScale); DataScript.screenTopCenter = FindTopOfTheScreen(); if (levelData.isLevelReversed) { Camera.main.transform.rotation = reversedCameraQuaternion; } for (int i = 0; i < whirlwinds.Count; i++) { GameObject currentWhirlwind = Instantiate(whirlwind, whirlwinds[i].position, Quaternion.identity); WhirlwindScript whirlwindScript = currentWhirlwind.GetComponent <WhirlwindScript>(); StartCoroutine(whirlwindScript.InitializeWhirlWind(whirlwinds[i].isRotatingClockwise, whirlwinds[i].rotatingSpeed, whirlwinds[i].delay)); } for (int i = 0; i < boxes.Count; i++) { DataScript.boxCountInLevel += 1; GameObject currentBox = Instantiate(box, boxes[i].position, box.transform.rotation); HitBoxScript hitBoxScript = currentBox.GetComponent <HitBoxScript>(); HitBoxMoverScript hitBoxMoverScript = currentBox.GetComponent <HitBoxMoverScript>(); hitBoxScript.count = boxes[i].count; Text text = currentBox.GetComponentInChildren <Text>(); text.text = boxes[i].count.ToString(); if (boxes[i].isMovingHorizontal) { StartCoroutine(hitBoxMoverScript.HitBoxOscillator(true, 0.05f, 0.01f)); } else if (boxes[i].isMovingVertical) { StartCoroutine(hitBoxMoverScript.HitBoxOscillator(false, 0.05f, 0.01f)); } //currentBox.transform.rotation = new Quaternion(0f, 180f, 0f,0f); } for (int i = 0; i < rotatingObjects.Count; i++) { GameObject currentRotatingObj = Instantiate(rotatingObject, rotatingObjects[i].position, Quaternion.identity); currentRotatingObj.transform.localScale = rotatingObjects[i].scale; currentRotatingObj.GetComponent <RotatingObjectScript>().isTrampoline = rotatingObjects[i].isTrampoline; currentRotatingObj.GetComponent <RotatingObjectScript>().isTrampolinedToRight = rotatingObjects[i].isTrampolinedRight; } for (int i = 0; i < obstaclePositions.Count; i++) { Instantiate(obstacle, obstaclePositions[i], Quaternion.identity); } }