This error message appears, what should I do?
using UnityEngine;
using UnityEngine.UI; //
using System.Collections;
public class PlayerHealth : MonoBehaviour
{
public int startingHealth = 100;
public int currentHealth; //qundo tomar dano valor cai
public Slider healthSlider; //barra de vida
public Image damageImage; //DamageImage
public AudioClip deathClip; //audio quando morre
public float flashspeed = 5f; //velocidade quando DamageImage pisca apagar para continuar vendo o jogo
public Color flashColour = new Color(1f, 0f, 0f, 0.1f); //cor da damageimage red gree blue alfa (transparente)
Animator anim; //puxar animação
AudioSource playerAudio; //vincular audio
PlayerMovement playerMovement; //sript playermovement (habilitar e desabilitar)
//PlayerShooting playerShooting;
bool isDead;
bool damaged;
void Awake () //pegando os componentes
{
anim = GetComponent <Animator> ();
playerAudio = GetComponent <AudioSource> ();
playerMovement = GetComponent <PlayerMovement> ();
//playerShooting = GetComponentInChildren <PlayerShooting> ();
currentHealth = startingHealth;
}
void Update ()
{
if(damaged)
{
damageImage.color = flashColour;
}
else
{
damageImage.color = Color.Lerp (damageImage.color, Color.clear, flashSpeed * Time.deltaTime);
}
damaged = false;
}
public void TakeDamage (int amount) //para ser chamado em outro script - o quanto de dano player tomou
{
damaged = true;
currentHealth -= amount;
healthSlider.value = currentHealth;
playerAudio.Play ();
if(currentHealth <= 0 && !isDead)
{
Death ();
}
}
void Death ()
{
isDead = true;
//playerShooting.DisableEffects ();
anim.SetTrigger ("Die");
playerAudio.clip = deathClip;
playerAudio.Play ();
playerMovement.enabled = false;
//playerShooting.enabled = false;
}
}