// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player"); playerBody = player.GetComponent <Rigidbody2D>(); cam = GetComponent <Camera>(); cam.transform.position = playerBody.transform.position; cam.orthographicSize = initOrtho; WaterDistortion effect = cam.GetComponent <WaterDistortion>(); GameObject level = GameObject.Find("Level"); ObstacleSpawner2 os2 = level.GetComponent <ObstacleSpawner2>(); switch (ServiceLocator.Difficulty) { case EDifficulty.Hard: { os2.additionalObjectsPerLevel *= 2; effect._Distortion *= 2.0f; effect._Waves += 2; abyssStart *= 0.5f; break; } case EDifficulty.Nightmare: { os2.additionalObjectsPerLevel *= 4; effect._Distortion *= 4.0f; effect._Waves += 5; abyssStart *= 0.25f; break; } } }
void Awake() { Text = transform.Find("Score").GetComponent <Text>(); Text.text = string.Format("Deepest distances:\nNormal: {0} m\nHard: {1} m\nNightmare: {2} m", PlayerPrefs.GetInt("Deepest_Normal"), PlayerPrefs.GetInt("Deepest_Hard"), PlayerPrefs.GetInt("Deepest_Nightmare")); CanvasCamera = gameObject.GetComponent <Canvas>().worldCamera; WaterEffect = CanvasCamera.GetComponent <WaterDistortion>(); }