Пример #1
0
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "Enemy")
        {
            enemy_script = col.GetComponent <enemy>();
            if (!enemy_script.frozen)
            {
                enemy_script.Freeze(duration);

                durability--;
                if (durability <= 0)
                {
                    Destroy(this.gameObject);
                }
            }
        }

        if (col.gameObject.tag == "Enemy2")
        {
            enemy_script2 = col.GetComponent <enemy2>();
            if (!enemy_script2.frozen)
            {
                enemy_script2.Freeze(duration);

                durability--;
                if (durability <= 0)
                {
                    Destroy(this.gameObject);
                }
            }
        }
    }