コード例 #1
0
    public void TakeDamage(int damage)
    {
        Health -= damage;
        healthBar.DecreasingHealth(damage);
        if (Health <= 0)
        {
            if (onPlayerDestroy != null)
            {
                onPlayerDestroy();
            }

            Destroy(gameObject, 0.1f);
        }
    }
コード例 #2
0
ファイル: BaseEnemy.cs プロジェクト: R3D87/Bomberman
    public void TakeDamage(int damage)
    {
        if (!DamageSensitive)
        {
            damage = 0;
        }

        Health -= damage;
        if (Health <= 0)
        {
            Destroy(gameObject, 0.1f);
        }
        else
        {
            healthBar.DecreasingHealth(damage);
        }
    }