Пример #1
0
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "Enemy" || col.gameObject.tag == "Enemy2" || col.gameObject.tag == "Pathway")
        {
            mortarshell_model.SetActive(false);
            m_render.enabled     = true;
            exploding            = true;
            rb.isKinematic       = true;
            rendr.material.color = explosion_color;

            if (col.gameObject.tag == "Enemy")
            {
                enemy_script = col.GetComponent <enemy>();
                enemy_script.ReceiveDamage(damage);
            }

            else if (col.gameObject.tag == "Enemy2")
            {
                enemy_script2 = col.GetComponent <enemy2>();
                enemy_script2.ReceiveDamage(damage);
            }

            else
            {
                //add fix here if necessary
            }
        }
    }
Пример #2
0
    void OnTriggerEnter(Collider col)
    {
        //Destroy(col.gameObject);
        if (col != null)
        {
            if (col.gameObject.tag == "Enemy")
            {
                GameObject effect = (GameObject)Instantiate(damage_effect, transform.position, transform.rotation);
                Destroy(effect, 1f);
                enemy_script = col.GetComponent <enemy>();
                enemy_script.ReceiveDamage(damage);
                Destroy(gameObject);
            }

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

            else
            {
                Destroy(gameObject);
            }
        }
    }
Пример #3
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>();
            enemy_script.ReceiveDamage(damage);

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

        if (col.gameObject.tag == "Enemy2")
        {
            GameObject effect = (GameObject)Instantiate(damage_effect, transform.position, transform.rotation);
            Destroy(effect, 1f);


            enemy_script2 = col.GetComponent<enemy2>();
            enemy_script2.ReceiveDamage(damage);

            durability--;
            if (durability <= 0)
            {
                Destroy(this.gameObject);
            }
        }
    }
Пример #4
0
    IEnumerator RecoverFromAttack(float waitTime)
    {
        enemy.ReceiveDamage(damageValue);
        yield return(new WaitForSeconds(waitTime));

        recover = null;
    }
Пример #5
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();
        }
    }
Пример #6
0
    void OnTriggerEnter(Collider col)
    {
        if (col != null)
        {
            if (col.gameObject.tag == "Enemy")
            {
                enemy_script = col.GetComponent <enemy>();
                enemy_script.ReceiveDamage(damage);
                exploding            = true;
                rb.isKinematic       = true;
                rendr.material.color = explosion_color;
            }

            if (col.gameObject.tag == "Enemy2")
            {
                enemy_script2 = col.GetComponent <enemy2>();
                enemy_script2.ReceiveDamage(damage);
                exploding            = true;
                rb.isKinematic       = true;
                rendr.material.color = explosion_color;
            }
        }
    }