public void SetCurrentHealth(float healthChange) { currentHealth += healthChange; if (healthChange < 0) { // Play sound playerAudio.PlayOneShot(audioManager.getHit); // Play effects. if (Camera.main.gameObject.GetComponent <CameraShake>() != null) { StartCoroutine(Camera.main.gameObject.GetComponent <CameraShake>().Shake()); } if (animatorManager != null) { animatorManager.PlayBloodScreen(); } // Change data values. SetCurrentSpeed(-currentSpeed / 2); ResetCombo(); // Change health indicators looking. if (healthSlot.childCount != 0) { Destroy(healthSlot.GetChild(healthSlot.childCount - 1).gameObject); StartCoroutine(ShowCurrentHealth()); } } if (currentHealth + healthChange > maxhealth) { healthChange = maxhealth; } else if (currentHealth + healthChange < 0) { healthChange = 0; } }