Beispiel #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();
        }
    }
Beispiel #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();
        }
    }
Beispiel #3
0
 private void VisualizeDamageNumbers(object sender, WeaponCollisionEventArgs args)
 {
     damageNumbers.text = dmgController.GetDamage().ToString();
     //Instantiating Damage Numbers
     Instantiate(damageNumbers, args.Target.position + new Vector3(Random.Range(-0.25f, 0.25f), Random.Range(-0.25f, 0.25f), Random.Range(-0.25f, 0.25f)), Quaternion.LookRotation(mainCamera.transform.position - args.Target.position));
 }