public void ReceiveDamage(int damage) { if (!m_CanRecieveDamage) { return; } m_Health -= damage; if (m_IsMainPlayer) { m_AudioSource.PlayOneShot(m_ReceiveDamageSound); m_CanRecieveDamage = false; m_HealthChangedEvent.Invoke(); StartCoroutine(InvulnerabilityEffect(m_ReceiveDamageEffect.m_DamageReceivedColor)); Invoke("ReturnFromInvulnerabilityState", m_ReceiveDamageEffect.m_DamageReceivedTime); } else { m_ReceiveDamageEffect.ApplyEffect(); } if (m_Health <= 0) { Invoke("Die", m_TimeUntilDie); } }
void ReceiveDamage() { m_Health -= 1; m_ReceiveDamageEffect.ApplyEffect(); }