Exemple #1
0
        public void TakeDamage(float amount)
        {
            // Reduce current health by the amount of damage done.
            m_CurrentHealth -= amount;

            tankDamaged.SetWarningTime();
            // Change the UI elements appropriately.
            SetHealthUI();

            // If the current health is at or below zero and it has not yet been registered, call OnDeath.
            if (m_CurrentHealth <= 0f && !m_Dead)
            {
                OnDeath();
            }
        }
    public void TakeDamage(float amount)
    {
        m_CurrentHealth -= amount;

        if (amount >= 1f)
        {
            cameraControl.StartShake();
            tankDamaged.SetWarningTime();
        }
        SetHealthUI();
        if (m_CurrentHealth <= 0f && !m_Dead)
        {
            OnDeath();
        }
    }