コード例 #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
ファイル: SpikeTrap.cs プロジェクト: jamest209/ShinobiBlitz
    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
    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();
        }
    }
コード例 #5
0
ファイル: Cannonball.cs プロジェクト: jamest209/ShinobiBlitz
    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;
            }
        }
    }