Пример #1
0
    /// <summary>
    /// Acts as a med pack for the player, recovers lost health and caps at their max health
    /// </summary>
    private void BonusHealth()
    {
        TankHealth th = _rb.GetComponent <TankHealth>();

        if (th.GetHealth() == th.m_StartingHealth)
        {
            return;
        }

        th.AddHealth(_healthAdd);
        if (th.GetHealth() > th.m_StartingHealth)
        {
            th.SetHealth(th.m_StartingHealth);
        }
        th.SetHealthUI();

        Destroy(gameObject);
    }