コード例 #1
0
    public void ManageDamage(DamageController damagecontroller)
    {
        // Applies damage to the health of this object
        health -= damagecontroller.GetDamage();

        //Destroys the laser on collision
        damagecontroller.Hit();

        //Destroys the object when the health is <= 0
        if (health <= 0)
        {
            //Triggers death function
            TriggerDeath();
        }
    }
コード例 #2
0
    private void ManageDamage(DamageController damagecontroller)
    {
        // Applies damage to the health of this object
        shield -= damagecontroller.GetDamage();

        // Updates the health bar
        UpdateHealthBar();

        // Destroys the laser on collision
        damagecontroller.Hit();

        //Destroys the object when the health is <= 0
        if (shield <= 0)
        {
            PlayerDie();
        }
    }