private void FixedUpdate() { if (damageable.IsInvoking("TakeDamage")) { animator.SetTrigger("damaged"); } //update stage if (damageable.currentHealth == 7) { movement.SetSpeedIncreased(); stage = 1; spawn0active = true; spawnPointIndex = UnityEngine.Random.Range(0, 1); Debug.Log("Stage 1"); //Camera Shake CameraShake cameraShakeScript = cameraShakeController.GetComponent <CameraShake>(); cameraShakeScript.StartCoroutine(cameraShakeScript.ShakeCamera()); } else if (damageable.currentHealth == 3) { stage = 2; spawn1active = true; spawn2active = true; spawnPointIndex = UnityEngine.Random.Range(0, 4); //Camera Shake CameraShake cameraShakeScript = cameraShakeController.GetComponent <CameraShake>(); cameraShakeScript.StartCoroutine(cameraShakeScript.ShakeCamera()); } // behave according to which stage if (stage == 0) { StageOne(); } else if (stage == 1) { StageTwo(); } else { StageThree(); } }