예제 #1
0
    public int TakeDamage(int damages)
    {
        m_hp -= damages;

        m_ui.SetLifeBarFill(m_hp / 100.0f);

        if (m_hp <= 0)
        {
            PlayDeathSound();
            Destroy(gameObject);
        }

        return(m_hp);
    }
예제 #2
0
파일: Unit.cs 프로젝트: SIL3nCe/DontWreck
    public void SetHP(int hp)
    {
        if (hp < 0)
        {
            hp = 0;
        }

        if (hp > m_maxHp)
        {
            hp = m_maxHp;
        }

        m_hp = hp;

        m_ui.SetLifeBarFill(m_hp / (float)m_maxHp);
    }