Пример #1
0
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "Enemy")
        {
            GameObject effect = (GameObject)Instantiate(damage_effect, transform.position, transform.rotation);
            Destroy(effect, 1f);
            enemy_script = col.GetComponent <enemy>();
            if (enemy_script.slowed)
            {
                damage += damage_bonus;
                enemy_script.ReceiveDamage(damage);
                damage -= damage_bonus;
            }
            else
            {
                enemy_script.ReceiveDamage(damage);
            }
            enemy_script.GetBurned();
        }

        if (col.gameObject.tag == "Enemy2")
        {
            GameObject effect = (GameObject)Instantiate(damage_effect, transform.position, transform.rotation);
            Destroy(effect, 1f);
            enemy_script2 = col.GetComponent <enemy2>();
            if (enemy_script2.slowed)
            {
                damage += damage_bonus;
                enemy_script2.ReceiveDamage(damage);
                damage -= damage_bonus;
            }
            else
            {
                enemy_script2.ReceiveDamage(damage);
            }
            enemy_script2.GetBurned();
        }
    }