void PlayerDead() { //Stops Player Movement **** need to work on this //playerMovement.enabled = false; //lastPlayerSighting.position = lastPlayerSighting.resetPosition; //Check what makes the audio stop completely //AudioManager.instance.musicSource.Pause(); //NEED TO CHECK IF AUDIO IS OFF, THEN PLAY //if (!AudioManager.instance.PlaySingle (deathClip)) { //AudioManager.instance.PlaySingle (deathClip); //} FlightPath.cameraMovement.speed = 0f; PlayerMovement.shipMovement.activateControls = false; GameObject DamScreen = GameObject.Find("DamageIndicator"); FadeDamageIndicator DamFade = DamScreen.GetComponent <FadeDamageIndicator> (); DamFade.PlayerDead(); LevelReset(); }
public void TakeDamage(float amount) { //reference to the screen damage indicator GameObject DamScreen = GameObject.Find("DamageIndicator"); FadeDamageIndicator DamFade = DamScreen.GetComponent <FadeDamageIndicator> (); //changes the color of the healthbar to red when hit FillColor.GetComponent <Image> ().color = new Color(255f, 0f, 0f); //call the damage indicator to flash red DamFade.FadeRed(); //Reduces players health health -= amount; //healthbar reflects the numerical value of health HealthBar.value = health; }